Skip to content

Commit

Permalink
lint: use .gitignore to decide eslint ignore patterns
Browse files Browse the repository at this point in the history
TODO: extract the eslint invocation to scripts/lint.ts so that it's not
duplicated in the "lintfix" task.
  • Loading branch information
justinmk3 committed Jul 12, 2024
1 parent 3636963 commit 702808d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 34 deletions.
24 changes: 0 additions & 24 deletions .eslintignore

This file was deleted.

16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Note: also used for `eslint --ignore-path`.

out
dist
node_modules
Expand Down Expand Up @@ -27,15 +29,15 @@ packages/core/src/shared/telemetry/vscodeTelemetry.json
.test-reports

# Auto generated type definitions
packages/core/src/shared/telemetry/clienttelemetry.d.ts
packages/core/src/codewhisperer/client/codewhispererclient.d.ts
packages/core/src/codewhisperer/client/codewhispereruserclient.d.ts
packages/core/src/amazonqFeatureDev/client/featuredevproxyclient.d.ts
packages/core/src/auth/sso/oidcclientpkce.d.ts
**/src/shared/telemetry/clienttelemetry.d.ts
**/src/codewhisperer/client/codewhispererclient.d.ts
**/src/codewhisperer/client/codewhispereruserclient.d.ts
**/src/amazonqFeatureDev/client/featuredevproxyclient.d.ts
**/src/auth/sso/oidcclientpkce.d.ts

# Generated by tests
packages/core/src/testFixtures/**/bin
packages/core/src/testFixtures/**/obj
**/src/testFixtures/**/bin
**/src/testFixtures/**/obj

# Generated by copyFiles.ts
packages/*/LICENSE
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"newChange": "echo 'Must specify subproject/workspace with -w packages/<subproject>' && false",
"createRelease": "echo 'Must specify subproject/workspace with -w packages/<subproject>' && false",
"lint": "npm run lint -w packages/ --if-present",
"lintfix": "eslint -c .eslintrc.js --fix --ext .ts packages plugins && npm run formatfix",
"lintfix": "eslint -c .eslintrc.js --ignore-path .gitignore --ignore-pattern '**/*.json' --ignore-pattern '**/*.gen.ts' --ignore-pattern '**/types/*.d.ts' --ignore-pattern '**/src/testFixtures/**' --ignore-pattern '**/resources/js/graphStateMachine.js' --fix --ext .ts packages plugins",
"clean": "npm run clean -w packages/ -w plugins/",
"reset": "npm run clean && ts-node ./scripts/clean.ts node_modules && npm install",
"generateNonCodeFiles": "npm run generateNonCodeFiles -w packages/ --if-present"
Expand Down
16 changes: 14 additions & 2 deletions packages/core/src/testLint/eslint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@ describe('eslint', function () {
'../../node_modules/.bin/eslint',
'-c',
'../../.eslintrc.js',
// Note: eslint currently does not support multiple --ignore-path args.
// Use --ignore-pattern as a workaround.
'--ignore-path',
'../../.eslintignore',
'../../.gitignore',
'--ignore-pattern',
'**/*.json',
'--ignore-pattern',
'**/*.gen.ts',
'--ignore-pattern',
'**/types/*.d.ts',
'--ignore-pattern',
'**/src/testFixtures/**',
'--ignore-pattern',
'**/resources/js/graphStateMachine.js',
'--ext',
'.ts',
'.',
Expand All @@ -25,6 +37,6 @@ describe('eslint', function () {
throws: false,
}
)
assert.strictEqual(result.status, 0, result.stdout.toString())
assert.strictEqual(result.status, 0, result.output.toString())
})
})

0 comments on commit 702808d

Please sign in to comment.