Skip to content

Commit

Permalink
chore(lint): proper formatting for control flow
Browse files Browse the repository at this point in the history
ng add @angular-eslint/schematics just does the job !
  • Loading branch information
Supamiu committed Aug 6, 2024
1 parent 38f6606 commit fd1bb9a
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 237 deletions.
309 changes: 151 additions & 158 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,160 +1,153 @@
{
"root": true,
"ignorePatterns": [
"src/**/*",
"**/*.stories.ts"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"packages/ng/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
// "plugin:@angular-eslint/template/process-inline-templates",
// Keep prettier at the end
"plugin:prettier/recommended"
// "plugin:@angular-eslint/ng-cli-compat",
// "plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
],
"plugins": [
"deprecation"
],
"rules": {
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
// OUR RULES
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "enumMember",
"format": [
"PascalCase",
"camelCase",
"UPPER_CASE"
]
}
],
// Would be nice to have these three but requires refactoring of old code
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/explicit-function-return-type": "off",
// on aimerait bien dire oui sauf pour void
"@typescript-eslint/explicit-module-boundary-types": "off",
// on aimerait bien dire oui sauf pour void
"@angular-eslint/no-input-rename": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/type-annotation-spacing": [
"error"
],
"no-console": [
"error",
{
"allow": [
"warn",
"error"
]
}
],
"curly": "error",
"deprecation/deprecation": "warn",
"no-restricted-imports": [
"error",
{
"paths": [
"rxjs/Rx",
"@ngneat/spectator"
]
}
],
"max-classes-per-file": "off",
"quote-props": [
"error",
"as-needed"
],
"quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"asyncArrow": "always",
"named": "never"
}
],
// BASIC RULES
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "lu",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "lu",
"style": "camelCase"
}
],
"@angular-eslint/no-host-metadata-property": "off"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended",
"plugin:prettier/recommended"
],
"rules": {
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
"@angular-eslint/template/button-has-type": "error"
}
},
{
"files": [
"*.js"
],
"env": {
"es6": true
}
}
]
"root": true,
"ignorePatterns": [
"src/**/*",
"**/*.stories.ts"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"packages/ng/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
// "plugin:@angular-eslint/template/process-inline-templates",
// Keep prettier at the end
"plugin:prettier/recommended"
// "plugin:@angular-eslint/ng-cli-compat",
// "plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
],
"plugins": [
"deprecation"
],
"rules": {
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
// OUR RULES
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "enumMember",
"format": [
"PascalCase",
"camelCase",
"UPPER_CASE"
]
}
],
// Would be nice to have these three but requires refactoring of old code
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/explicit-function-return-type": "off",
// on aimerait bien dire oui sauf pour void
"@typescript-eslint/explicit-module-boundary-types": "off",
// on aimerait bien dire oui sauf pour void
"@angular-eslint/no-input-rename": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/type-annotation-spacing": [
"error"
],
"no-console": [
"error",
{
"allow": [
"warn",
"error"
]
}
],
"curly": "error",
"deprecation/deprecation": "warn",
"no-restricted-imports": [
"error",
{
"paths": [
"rxjs/Rx",
"@ngneat/spectator"
]
}
],
"max-classes-per-file": "off",
"quote-props": [
"error",
"as-needed"
],
"quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"asyncArrow": "always",
"named": "never"
}
],
// BASIC RULES
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "lu",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "lu",
"style": "camelCase"
}
],
"@angular-eslint/no-host-metadata-property": "off"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
"@angular-eslint/template/button-has-type": "error"
}
},
{
"files": [
"*.js"
],
"env": {
"es6": true
}
}
]
}
13 changes: 10 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@
"endOfLine": "auto",
"overrides": [
{
"files": [".component.html", ".page.html"],
"files": [
"*.component.html",
"*.page.html"
],
"options": {
"parser": "angular"
}
},
{
"files": ["*.html"],
"files": [
"*.html"
],
"options": {
"parser": "html",
"singleQuote": false
}
},
{
"files": ["*.ts"],
"files": [
"*.ts"
],
"options": {
"parser": "typescript",
"printWidth": 200
Expand Down
Loading

0 comments on commit fd1bb9a

Please sign in to comment.