TypeScript Angular ESlint - Definition for rule typescript-eslint space-infix-ops was not found

0 votes

I recently removed the tslint from my angular project - I read it was depreciated, so thought I best get my hands dirty and switch to eslint.

So I removed the tslint files, ran ng add @angular-eslint/schematics to install the lint schematics, installed the airbnb typescript linter, amended the ng lint task to run like so...

"lint": "eslint -c .eslintrc.js --ext .ts ./src/app"

I added a .eslintrc.js file and populated it with the following

module.exports = {
  root: true,
  extends: [
    'airbnb-typescript/base',
    'plugin:@angular-eslint/recommended'
  ],
  ignorePatterns: [
    'node_modules/',
    'build/',
    'dist/',
    'e2e/'
  ],
  rules: {
    'comma-dangle': ['error', 'only-multiline'],
    'max-len': ['error', {code: 120, tabWidth: 4}],
    'no-underscore-dangle': 'off',
    'no-await-in-loop': 'off',
    'import/prefer-default-export': 'off',
    'no-param-reassign': ['error', {props: false}],
    'strict': ['error', 'global'],
    'func-names': 'off', // I use a lot of unnamed functions
    'global-require': 'off',
    'class-methods-use-this': 'off', // Disabled for Angular Controllers,
    'import/extensions': [
      'error',
      'ignorePackages',
      {
        js: 'never',
        ts: 'never',
      }
    ]
  },
  plugins: [
    '@angular-eslint/eslint-plugin'
  ],
  parserOptions: {
    project: 'tsconfig.json',
    sourceType: 'module'
  }
}

everything worked really well... but when I run ng lint I get the following error...

1:1 error Definition for rule '@typescript-eslint/space-infix-ops' was not found @typescript-eslint/space-infix-ops 1:1 error Definition for rule '@typescript-eslint/object-curly-spacing' was not found @typescript-eslint/object-curly-spacing

This is strange as I don't include rules for these in the .eslintrc.js file? I then ran npm update hoping that may solve the issue but it doesn't? I'm currently looking through stackoverflow for an answer but if anyone has a direct answer please let me know what to do, any help is appreciated.

I'm unsure if this helps but this is the contents on my package.json

"@angular-devkit/build-angular": "^0.1102.3",
"@angular-eslint/builder": "1.2.0",
"@angular-eslint/eslint-plugin": "1.2.0",
"@angular-eslint/eslint-plugin-template": "1.2.0",
"@angular-eslint/schematics": "1.2.0",
"@angular-eslint/template-parser": "1.2.0",
"@angular/animations": "^11.2.4",
"@angular/cli": "^11.2.3",
"@angular/common": "^11.2.4",
"@angular/compiler": "^11.2.4",
"@angular/compiler-cli": "^11.2.4",
"@angular/core": "^11.2.4",
"@angular/forms": "^11.2.4",
"@angular/http": "~7.0.0",
"@angular/language-service": "^11.2.4",
"@angular/platform-browser": "^11.2.4",
"@angular/platform-browser-dynamic": "^11.2.4",
"@angular/router": "^11.2.4",
"@compodoc/compodoc": "^1.1.11",
"@types/jasmine": "^2.8.17",
"@types/jasminewd2": "^2.0.8",
"@types/node": "^8.10.66",
"@typescript-eslint/eslint-plugin": "4.3.0",
"@typescript-eslint/parser": "4.3.0",
"codelyzer": "~4.5.0",
"core-js": "^2.6.9",
"eslint": "^7.6.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"eslint-plugin-prettier": "^3.3.1",
"is-docker": "^1.1.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"material-design-icons": "^3.0.1",
"ng-packagr": "^11.2.4",
"ngx-highlightjs": "^4.1.3",
"prettier": "^2.2.1",
"protractor": "^5.4.4",
"roboto-fontface": "^0.10.0",
"rxjs": "~6.6.6",
"scss-bundle": "^2.5.1",
"tsickle": "^0.33.1",
"tslint": "~5.11.0",
"typescript": "~4.1.5",
"zone.js": "~0.11.4"
Jun 15 in TypeSript by Logan
• 2,140 points
58 views

1 answer to this question.

0 votes
I managed to resolve this by forcing the version "@typescript-eslint/eslint-plugin": "^4.17.0" - just using npm update didn't seem to work
answered Jun 16 by Nina
• 3,020 points

Related Questions In TypeSript

0 votes
0 answers
0 votes
1 answer

The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.3 was found instead

Run this script to find exact version npm ...READ MORE

answered 5 days ago in TypeSript by Abhinaya
• 760 points
9 views
0 votes
1 answer

TypeScript: 'tsc command not found'

A few tips in order restart the terminal restart ...READ MORE

answered Jun 7 in TypeSript by Nina
• 3,020 points
239 views
0 votes
1 answer

Typescript: Property "XXX" does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes

Double check the newly added object types. ...READ MORE

answered Jun 8 in TypeSript by Nina
• 3,020 points
2,022 views
0 votes
1 answer
0 votes
1 answer

How to set meta tags using Angular universal SSR and ngx-seo plug-in?

first Install the plug-in with npm i ngx-seo ...READ MORE

answered Feb 11 in Others by narikkadan
• 11,280 points
688 views
0 votes
0 answers

Can't bind to 'ngModel' since it isn't a known property of 'input'

I have this  input in my component ...READ MORE

Apr 29 in Other DevOps Questions by Kichu
• 19,040 points
140 views
0 votes
1 answer

VS Code enforces semicolons, but why doesn't Angular and TypeScript not use it consistently?

JavaScript has a syntactic feature known as semicolon ...READ MORE

answered May 31 in TypeSript by Nina
• 3,020 points
44 views
0 votes
1 answer

Definition for rule '@typescript-eslint/no-shadow' was not found

v2.34.0 of the typescript-eslint packages is 9 months ...READ MORE

answered Jun 13 in TypeSript by Nina
• 3,020 points
244 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP