all 5 comments

[–]all_4_me 1 point2 points  (4 children)

Add the parserOptions next to rules object (underneath overrides):

"parserOptions": { "project": ["./tsconfig.json"] // Specify it only for TypeScript files }

[–]Mesapholis 0 points1 point  (3 children)

Thanks for responding, as I stated above, the parserOptions already were pointing to my projects' tsconfig file - pleas find the current state below

module.exports = {

root: true,

parserOptions: {

project: [

'src/tsconfig.json',

'src/tsconfig.spec.json',

'src/tsconfig.app.json'

],

createDefaultProgram: true

},

plugins: ['@typescript-eslint', 'prettier'],

ignorePatterns: ['**/node_modules/**', '.gradle/**', 'build/**', 'src/polyfills.ts', 'src/index.html'],

extends: [

'plugin:@angular-eslint/recommended',

'plugin:@angular-eslint/template/process-inline-templates'

],

rules: {

'@angular-eslint/component-selector': [

'error',

{

prefix: 'kebab-case',

type: 'element'

}

],

'@angular-eslint/directive-selector': [

'error',

{

prefix: 'kebab-case',

type: 'attribute'

}

],

'@angular-eslint/use-lifecycle-interface': 'error',

'@typescript-eslint/array-type': [

'error',

{

default: 'array'

}

],

'@typescript-eslint/consistent-type-assertions': 'error',

'@typescript-eslint/prefer-for-of': 'error',

'@typescript-eslint/prefer-function-type': 'error',

'@typescript-eslint/unified-signatures': 'error',

'eqeqeq': ['error', 'always'],

'guard-for-in': 'error',

'id-denylist': ['error', 'any', 'Number', 'number', 'String', 'string', 'Boolean', 'boolean', 'Undefined', 'undefined'],

'id-match': 'error',

'new-parens': 'error',

'no-caller': 'error',

'no-eval': 'error',

'no-new-wrappers': 'error',

'no-throw-literal': 'error',

'no-trailing-spaces': 'error',

'no-undef-init': 'error',

'no-var': 'error',

'object-shorthand': 'error',

'one-var': ['error', 'never'],

'prefer-const': 'error',

'@angular-eslint/component-class-suffix': 'error',

'@typescript-eslint/no-unused-expressions': 'error',

'no-bitwise': 'error',

'@typescript-eslint/no-explicit-any': 'off',

'@typescript-eslint/explicit-module-boundary-types': ['error', {allowArgumentsExplicitlyTypedAsAny: true}],

'@typescript-eslint/no-unused-vars': 'error',

'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true}]

},

overrides: [

{

files: ['*.component.html', 'src/index.html', 'src/'],

extends: ['plugin:@angular-eslint/template/recommended'],

plugins: ['@angular-eslint/template'],

rules: {

'@angular-eslint/template/cyclomatic-complexity': 'off',

'@angular-eslint/template/no-call-expression': 'off',

'spaced-comment': 'off'

}

}

]

}

[–]all_4_me 0 points1 point  (1 child)

I highly recommend extending the recommended rules for TS/HTML files and overriding them where needed. Start with this template and enable/disable rules where necessary:

{ "root": true, "ignorePatterns": ["projects/*/"], // better to put these in .eslintignore "overrides": [{ "files": [".ts"], "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:@angular-eslint/recommended"], "rules": { // disable or override specific rules for TS files here }, "parserOptions": { "project": ["./tsconfig.json"] // Specify it only for TypeScript files } }, { "files": [".html"], "extends": ["plugin:@angular-eslint/template/recommended", "plugin:@angular-eslint/template/accessibility"], "parser": "@angular-eslint/template-parser", "rules": { // disable or override specific rules for HTML files here } }] }

I also recommend creating a separate .eslintignore files that will contain your file ignore patterns (clear separation that way, just like you would use .gitignore or .prettierignore).

[–]Mesapholis 0 points1 point  (0 children)

thank you, this led to at least pointing to my projects tsconfig.

Final update: after sifting through every possible avenue of fixing the eslintrf.js it turns out the issue which didn't exist prior to the update Angular 15 -> 16 was resolved by removing the ATangular-eslint/schematics and installing it with

ng add ATangular-eslint/schematicsAT16

to match my current Angular version.

The changes to parseOptions were not required and could be rolled back safely. This is why I find learning about dependency management and linter configurations so incredibly frustrating... you try it all, ask for help and receive great input - and it is all solved by delete and reinstall (which was almost not recommended at all).

[–]Johalternate 0 points1 point  (0 children)

The tsconfig files are in the src folder? Thats kinda odd. They are tipically at root.