Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/metal-olives-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-config-custom': minor
---

Extends ESLint capabilities for individual packages
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/coverage/**
**/node_modules/**
packages/*/dist/**
packages/eslint-config-custom/**
**/dist/*
**/build/*
playground
Expand Down
4 changes: 0 additions & 4 deletions .eslintrc.js

This file was deleted.

38 changes: 38 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

##############################
# Determine Staged Packages
##############################

staged_files=$(git diff --name-only --cached --diff-filter=ACM)

# Initialize an empty string to hold the unique folder paths
unique_folders=""

# Loop through each staged file
for file in $staged_files; do
# Extract the first two folders from the file path
folder=$(echo $file | awk -F'/' '{print $1 "/" $2}')

# Filter files which end with .mjs, .js, .jsx, .ts, or .tsx [NOTE: Should match ./.lintstagedrc.json]
if [[ $file =~ \.(mjs|js|jsx|ts|tsx)$ ]]; then
# Check if this folder is already in the list of unique folders
if [[ $folder == packages/* ]] && [[ ! " $unique_folders " =~ "$folder" ]]; then
# Append the folder to the list of unique folders
unique_folders="$unique_folders --filter={./$folder}^..."
fi
fi
done

##############################
# Build Staged Packages
##############################

if [ -n "$unique_folders" ]; then
npx turbo run build --output-logs=errors-only $unique_folders
else
echo "SKIPPING: No packages to build"
fi

##############################
# Run Lint Staged
##############################

npx lint-staged
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*.{mjs,js,jsx,ts,tsx}": ["npx prettier --write", "npx eslint --fix"],
"*.{mjs,js,jsx,ts,tsx}": ["npx eslint --fix", "npx prettier --write"],
"*.{json,md,mdx}": ["npx prettier --write"]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": true
}
},
"eslint.workingDirectories": [{ "mode": "auto" }],
}
30 changes: 30 additions & 0 deletions integration/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// TODO: All rules below should be set to their defaults
// when we're able to make the appropriate changes.
const disabledRules = {
'playwright/expect-expect': 'off',
'playwright/no-skipped-test': 'off',
'playwright/no-page-pause': 'warn',
};

module.exports = {
root: true,
ignorePatterns: ['!.*.js', '*.snap', 'templates/**'],
extends: ['custom/node', 'custom/typescript', 'custom/playwright'],
rules: {
...disabledRules,
},
overrides: [
{
files: ['./models/deployment.ts', './testUtils/emailService.ts'],
rules: {
'@typescript-eslint/no-unnecessary-type-assertion': 'warn', // TODO: Remove when we able to update tests
},
},
{
files: ['./testUtils/testAgainstRunningApps.ts', './presets/longRunningApps.ts'],
rules: {
'@typescript-eslint/no-redundant-type-constituents': 'warn', // TODO: Remove when we able to update tests
},
},
],
};
6 changes: 3 additions & 3 deletions integration/templates/next-app-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"dev": "next dev",
"lint": "next lint",
"start": "next start"
},
"dependencies": {
"@types/node": "20.3.2",
Expand Down
46 changes: 23 additions & 23 deletions integration/templates/react-cra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,11 @@
"name": "react-cra",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.37",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "BROWSER=none react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
"eject": "react-scripts eject",
"start": "BROWSER=none react-scripts start",
"test": "react-scripts test"
},
"browserslist": {
"production": [
Expand All @@ -39,5 +19,25 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.37",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
}
}
4 changes: 2 additions & 2 deletions integration/templates/react-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "react-vite",
"private": true,
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --port $PORT --no-open",
"build": "tsc && vite build",
"dev": "vite --port $PORT --no-open",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview --port $PORT --no-open"
},
Expand Down
5 changes: 5 additions & 0 deletions integration/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["./*.ts", "deployments", "presets", "scripts", "tests", "testUtils"],
"exclude": ["templates"]
}
Loading