-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ESlint to v9 w/flat config & fix linting errors #724
- Loading branch information
Showing
102 changed files
with
820 additions
and
732 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
// @ts-check | ||
import eslint from "@eslint/js"; | ||
import angular from "angular-eslint"; | ||
import eslintConfigPrettier from "eslint-config-prettier"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
export default tseslint.config( | ||
{ ignores: ["coverage/", "dist/"] }, | ||
{ | ||
// Everything in this config object targets our TypeScript files (Components, Directives, Pipes etc) | ||
files: ["**/*.ts"], | ||
extends: [ | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommendedTypeChecked, | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
projectService: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}, | ||
// ...tseslint.configs.stylistic, | ||
...angular.configs.tsRecommended, | ||
eslintConfigPrettier, | ||
], | ||
// Set the custom processor which will allow us to have our inline Component templates extracted | ||
// and treated as if they are HTML files (and therefore have the .html config below applied to them) | ||
processor: angular.processInlineTemplates, | ||
// Override specific rules for TypeScript files (these will take priority over the extended configs above) | ||
rules: { | ||
"@angular-eslint/component-selector": [ | ||
"error", | ||
{ | ||
prefix: "bkd", | ||
style: "kebab-case", | ||
type: "element", | ||
}, | ||
], | ||
|
||
"@angular-eslint/directive-selector": [ | ||
"error", | ||
{ | ||
type: "attribute", | ||
prefix: "bkd", | ||
style: "camelCase", | ||
}, | ||
], | ||
|
||
"no-restricted-globals": [ | ||
"error", | ||
{ | ||
name: "fdescribe", | ||
message: "Do not commit 'fdescribe'. Use 'describe' instead.", | ||
}, | ||
], | ||
|
||
"no-restricted-imports": [ | ||
"error", | ||
{ | ||
patterns: [ | ||
{ | ||
group: ["fp-ts/lib/*"], | ||
message: "Please use 'fp-ts/es6' instead.", | ||
}, | ||
], | ||
|
||
paths: [ | ||
{ | ||
name: "@ng-bootstrap/ng-bootstrap", | ||
importNames: ["NgbModal"], | ||
message: "Please use 'BkdModalService' instead.", | ||
}, | ||
], | ||
}, | ||
], | ||
|
||
"@typescript-eslint/no-deprecated": "warn", | ||
|
||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
argsIgnorePattern: "_.*", | ||
}, | ||
], | ||
|
||
// Ignore some strict rules introduced by typescript-eslint since the | ||
// would be a lot of work to fix | ||
"@typescript-eslint/no-unsafe-member-access": "off", | ||
"@typescript-eslint/no-unsafe-assignment": "off", | ||
"@typescript-eslint/no-unsafe-return": "off", | ||
"@typescript-eslint/no-unsafe-argument": "off", | ||
"@typescript-eslint/no-unsafe-call": "off", | ||
"@typescript-eslint/unbound-method": "off", | ||
"@typescript-eslint/restrict-template-expressions": "off", | ||
"@typescript-eslint/no-unsafe-enum-comparison": "off", | ||
}, | ||
}, | ||
{ | ||
// Everything in this config object targets our HTML files (external templates, | ||
// and inline templates as long as we have the `processor` set on our TypeScript config above) | ||
files: ["**/*.html"], | ||
extends: [ | ||
// Apply the recommended Angular template rules | ||
...angular.configs.templateRecommended, | ||
// Apply the Angular template rules which focus on accessibility of our apps | ||
...angular.configs.templateAccessibility, | ||
], | ||
rules: {}, | ||
}, | ||
); | ||
|
||
// export default [{ | ||
// ignores: ["projects/**/*"], | ||
// }, ...compat.extends( | ||
// "eslint:recommended", | ||
// "plugin:@typescript-eslint/recommended", | ||
// "plugin:@angular-eslint/recommended", | ||
// "plugin:@angular-eslint/template/process-inline-templates", | ||
// "prettier", | ||
// ).map(config => ({ | ||
// ...config, | ||
// files: ["**/*.ts"], | ||
// })), { | ||
// files: ["**/*.ts"], | ||
// plugins: {}, | ||
|
||
// languageOptions: { | ||
// ecmaVersion: 5, | ||
// sourceType: "script", | ||
|
||
// parserOptions: { | ||
// project: ["tsconfig.json"], | ||
// createDefaultProgram: true, | ||
// }, | ||
// }, | ||
|
||
// rules: { | ||
// "@angular-eslint/component-selector": ["error", { | ||
// prefix: "bkd", | ||
// style: "kebab-case", | ||
// type: "element", | ||
// }], | ||
|
||
// "@angular-eslint/directive-selector": ["error", { | ||
// type: "attribute", | ||
// prefix: "bkd", | ||
// style: "camelCase", | ||
// }], | ||
|
||
// "no-restricted-globals": ["error", { | ||
// name: "fdescribe", | ||
// message: "Do not commit 'fdescribe'. Use 'describe' instead.", | ||
// }], | ||
|
||
// "no-restricted-imports": ["error", { | ||
// patterns: [{ | ||
// group: ["fp-ts/lib/*"], | ||
// message: "Please use 'fp-ts/es6' instead.", | ||
// }], | ||
|
||
// paths: [{ | ||
// name: "@ng-bootstrap/ng-bootstrap", | ||
// importNames: ["NgbModal"], | ||
// message: "Please use 'BkdModalService' instead.", | ||
// }], | ||
// }], | ||
|
||
// "@typescript-eslint/no-deprecated": "warn", | ||
|
||
// "@typescript-eslint/no-unused-vars": ["error", { | ||
// argsIgnorePattern: "_.*", | ||
// }], | ||
// }, | ||
// }, ...compat.extends("plugin:@angular-eslint/template/recommended", "prettier").map(config => ({ | ||
// ...config, | ||
// files: ["**/*.html"], | ||
// })), { | ||
// files: ["**/*.html"], | ||
// rules: {}, | ||
// }]; |
Oops, something went wrong.