Skip to content

Instantly share code, notes, and snippets.

@pratheeshrussell
Last active May 23, 2023 06:12
Show Gist options
  • Save pratheeshrussell/99b4269e10ffad6ee2642bfc3a007ef0 to your computer and use it in GitHub Desktop.
Save pratheeshrussell/99b4269e10ffad6ee2642bfc3a007ef0 to your computer and use it in GitHub Desktop.
Eslintrc for Angular
{
"root": true,
"ignorePatterns": ["projects/**/*"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"overrides": [
{
"files": ["*.ts"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:prettier/recommended"
],
"rules": {
"no-alert": "warn",
"no-debugger": "error",
"no-console": [
"error",
{
"allow": ["warn", "error", "clear"]
}
],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-for-in-array": "warn",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowHigherOrderFunctions": true
}
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": ["variableLike", "method", "property"],
"format": ["camelCase"]
},
{
"selector": "typeLike",
"format": ["PascalCase"]
},
{
"selector": ["variable", "property"],
"types": ["boolean"],
"format": ["PascalCase"],
"prefix": ["is", "should", "has", "can", "did", "will"]
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"prettier/prettier": "warn"
}
},
{
"files": ["*.html"],
"extends": [
"plugin:@angular-eslint/template/recommended",
"plugin:@angular-eslint/template/accessibility",
"plugin:prettier/recommended"
],
"rules": {
"prettier/prettier": ["warn", { "parser": "angular" }]
}
}
]
}
{
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "lf",
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment