Run ESLint at the top level once (#1202)

This significantly speeds up `yarn lint` for me. It also ensures we’re
listing all source files in the project, including the `.eslintrc` files
and any other files that may be present.
This commit is contained in:
Jed Fox
2023-06-26 15:32:56 -04:00
committed by GitHub
parent ea4a68e06c
commit ed50e2b392
20 changed files with 52 additions and 54 deletions

26
.eslintignore Normal file
View File

@@ -0,0 +1,26 @@
packages/api/app/bundle.api.js
packages/api/dist
packages/crdt/dist
packages/desktop-client/bundle.browser.js
packages/desktop-client/build/
packages/desktop-client/public/kcab/
packages/desktop-client/public/data/
packages/desktop-client/**/node_modules/*
packages/desktop-client/node_modules/
packages/desktop-electron/client-build/
packages/desktop-electron/dist/
packages/import-ynab4/**/node_modules/*
packages/import-ynab5/**/node_modules/*
packages/loot-core/**/node_modules/*
packages/loot-core/**/lib-dist/*
packages/loot-core/**/proto/*
packages/node-libofx/libofx.*.js
packages/node-libofx/libofx/
packages/node-libofx/OpenSP-*/

View File

@@ -70,7 +70,7 @@ module.exports = {
],
'import/no-useless-path-segments': 'error',
'import/no-duplicates': ['error', { 'prefer-inline': true }],
'import/no-unused-modules': ['error', { 'unusedExports': true }],
'import/no-unused-modules': ['error', { unusedExports: true }],
'import/order': [
'error',
{
@@ -120,8 +120,11 @@ module.exports = {
},
overrides: [
{
files: ['./**/*.js'],
files: ['.eslintrc.js', './**/.eslintrc.js'],
parserOptions: { project: null },
rules: {
'@typescript-eslint/consistent-type-exports': 'off',
},
},
{
files: [
@@ -171,29 +174,32 @@ module.exports = {
files: ['./packages/loot-core/src/**/*'],
rules: {
// defining 'src' to check all packages is slow, so only do it for loot-core
'import/no-unused-modules': ['error', { 'unusedExports': true, 'src': ['../**/*.{js,ts,tsx}'] }],
}
'import/no-unused-modules': [
'error',
{ unusedExports: true, src: ['../**/*.{js,ts,tsx}'] },
],
},
},
{
files: [
'**/icons/**/*.js',
'**/mocks/**/*.{js,ts,tsx}',
'**/{mocks,__mocks__}/*.{js,ts,tsx}',
'**/icons/**/*.js',
'**/mocks/**/*.{js,ts,tsx}',
'**/{mocks,__mocks__}/*.{js,ts,tsx}',
// can't correctly resolve usages
'**/*.{testing,electron,browser,web,api}.ts',
'packages/loot-core/src/server/main.ts'
'packages/loot-core/src/server/main.ts',
],
rules: { 'import/no-unused-modules': 'off' }
rules: { 'import/no-unused-modules': 'off' },
},
],
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
}
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
},
};

View File

@@ -33,7 +33,7 @@
"e2e": "yarn workspaces foreach --parallel --verbose run e2e",
"rebuild-electron": "./node_modules/.bin/electron-rebuild -f -m ./packages/loot-core",
"rebuild-node": "yarn workspace loot-core rebuild",
"lint": "cross-env NODE_ENV=development yarn workspaces foreach --verbose run lint --max-warnings 0",
"lint": "eslint . --max-warnings 0",
"typecheck": "yarn tsc",
"postinstall": "patch-package"
},

View File

@@ -1,2 +0,0 @@
app/bundle.api.js
dist

View File

@@ -9,7 +9,6 @@
"dist"
],
"scripts": {
"lint": "eslint .",
"build:app": "yarn workspace loot-core build:api",
"build:node": "tsc --p tsconfig.dist.json",
"build:migrations": "cp migrations/*.sql dist/migrations",

View File

@@ -1 +0,0 @@
dist

View File

@@ -9,7 +9,6 @@
"dist"
],
"scripts": {
"lint": "eslint .",
"build:node": "tsc --p tsconfig.dist.json",
"build": "rm -rf dist && yarn run build:node && cp src/proto/sync_pb.d.ts dist/src/proto/",
"test": "jest -c jest.config.js"

View File

@@ -1,6 +0,0 @@
bundle.browser.js
build/
public/kcab/
public/data/
**/node_modules/*
node_modules/

View File

@@ -58,8 +58,7 @@
"build": "cross-env INLINE_RUNTIME_CHUNK=false react-app-rewired build",
"build:browser": "cross-env ./bin/build-browser",
"test": "react-app-rewired test",
"e2e": "npx playwright test --browser=chromium",
"lint": "eslint ."
"e2e": "npx playwright test --browser=chromium"
},
"jest": {
"setupFilesAfterEnv": [

View File

@@ -1,2 +0,0 @@
client-build/
dist/

View File

@@ -8,7 +8,6 @@
"clean": "rm -rf dist",
"update-client": "bin/update-client",
"build": "electron-builder",
"lint": "eslint .",
"watch": "cross-env ACTUAL_DOCUMENT_DIR=\"../../data\" ACTUAL_DATA_DIR=\"../../data\" electron ."
},
"main": "index.js",

View File

@@ -5,7 +5,6 @@
"exports": "./lib/index.js",
"type": "commonjs",
"scripts": {
"lint": "eslint .",
"test": "jest"
},
"dependencies": {

View File

@@ -1 +0,0 @@
**/node_modules/*

View File

@@ -15,9 +15,6 @@
},
"bin": "./index.js",
"homepage": "https://github.com/actualbudget/actual/tree/master/packages/import-ynab4#readme",
"scripts": {
"lint": "eslint ."
},
"dependencies": {
"@actual-app/api": "*",
"adm-zip": "^0.5.9",

View File

@@ -1 +0,0 @@
**/node_modules/*

View File

@@ -15,9 +15,6 @@
},
"bin": "./index.js",
"homepage": "https://github.com/actualbudget/actual/tree/master/packages/import-ynab5#readme",
"scripts": {
"lint": "eslint ."
},
"dependencies": {
"@actual-app/api": "*",
"date-fns": "^2.29.3",

View File

@@ -1,3 +0,0 @@
**/node_modules/*
**/lib-dist/*
**/proto/*

View File

@@ -9,7 +9,6 @@
"build:api": "cross-env NODE_ENV=development webpack --config ./webpack/webpack.api.config.js; ./bin/copy-migrations ../api",
"build:browser": "cross-env NODE_ENV=production ./bin/build-browser",
"watch:browser": "cross-env NODE_ENV=development ./bin/build-browser",
"lint": "eslint .",
"test": "npm-run-all -cp 'test:*'",
"test:node": "jest -c jest.config.js",
"test:web": "jest -c jest.web.config.js"

View File

@@ -1,3 +0,0 @@
libofx.*.js
libofx/
OpenSP-*/

View File

@@ -4,8 +4,5 @@
"description": "",
"main": "index.js",
"author": "",
"license": "ISC",
"scripts": {
"lint": "eslint ."
}
"license": "ISC"
}