Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to turn of semicolon error in a Eslint.js file and typescrip

I want to use semicolons in my typescript files, but eslint is giving me an error Extra semicolon.eslint@typescript-eslint/semi now I went to the docs and it tells me to put this in my eslint file

"rules": {
    // Note: you must disable the base rule as it can report incorrect errors
    "semi": "off",
    "@typescript-eslint/semi": "warn"
  }

The problem is that my eslint file is a .js file not a .json file so I can’t put "@typescript-eslint/semi": "warn" because it gives me an error

Edit: this is the eslit.js file

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

module.exports = {
  env: {
    browser: true,
    es2021: true
  },
  extends: [
    'plugin:react/recommended',
    'plugin:react/jsx-runtime',
    'standard-with-typescript'
  ],
  overrides: [],
  parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
    project: ['./tsconfig.json']
  },
  plugins: ['react'],
  rules: {
    semi: 'off'
  }
};

>Solution :

Just add it into rules, the exaclty same way
DO NOT FORGET THE QUOTES

  plugins: ['react'],
  rules: {
    semi: 'off',
    "@typescript-eslint/semi": "warn" // < just add it
  }
};
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading