Skip to content

Instantly share code, notes, and snippets.

@cyrilletuzi
Last active June 7, 2021 09:10
Show Gist options
  • Save cyrilletuzi/a42ba889c5c2789fa040be14df582fa2 to your computer and use it in GitHub Desktop.
Save cyrilletuzi/a42ba889c5c2789fa040be14df582fa2 to your computer and use it in GitHub Desktop.
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
// Good practice to differentiate component types
"@angular-eslint/component-class-suffix": [
"error",
{
"suffixes": [
"Component",
"Page"
]
}
],
// Prefixes
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
// Strict types
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
// Stricter Angular ESLint rules
"@angular-eslint/contextual-decorator": "error",
"@angular-eslint/no-attribute-decorator": "error",
"@angular-eslint/no-forward-ref": "error",
"@angular-eslint/no-input-prefix": "error",
"@angular-eslint/no-lifecycle-call": "error",
"@angular-eslint/no-pipe-impure": "error",
"@angular-eslint/no-queries-metadata-property": "error",
"@angular-eslint/use-component-view-encapsulation": "error",
"@angular-eslint/use-injectable-provided-in": "error",
// Annoying as Angular CLI generates empty constructors and `ngOnInit()`
"@typescript-eslint/no-empty-function": "off",
"@angular-eslint/no-empty-lifecycle-method": "off",
// Allow Angular forms validators like `Validator.required`
"@typescript-eslint/unbound-method": [
"error",
{
"ignoreStatic": true
}
],
// Formatting rules (can be removed when using a dedicated tool like Prettier)
"quotes": "off",
"@typescript-eslint/quotes": [
"warn",
"single",
{
"allowTemplateLiterals": true
}
]
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
// Strict types
"@angular-eslint/template/no-any": "error",
// Stricter Angular ESLint rules
"@angular-eslint/template/conditional-complexity": "error",
"@angular-eslint/template/cyclomatic-complexity": "error",
"@angular-eslint/template/no-call-expression": "error",
"@angular-eslint/template/no-duplicate-attributes": "error",
// Accessibility
"@angular-eslint/template/accessibility-alt-text": "error",
"@angular-eslint/template/accessibility-elements-content": "error",
"@angular-eslint/template/accessibility-table-scope": "error",
"@angular-eslint/template/accessibility-valid-aria": "error",
"@angular-eslint/template/click-events-have-key-events": "error",
"@angular-eslint/template/mouse-events-have-key-events": "error",
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-distracting-elements": "error",
"@angular-eslint/template/no-positive-tabindex": "error",
"@angular-eslint/template/accessibility-label-for": "error"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment