Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable check of camel case rule in eslint

I have a large JavaScript file with multiple eslint rule violations. I am trying to disable them and address them one at a time. The code below shows that I can disable them all with no trouble, but not the rule about camelcase and perhaps other individual rules. The approaches I have used should work according to the eslint documentation, but there must be a flaw in my interpretation.

The code is short and it does not eliminate the error concerning camel case.

/* eslint-disable  /* eslint-disable//  works but gets everything. `/* eslint (camelcase) : 0 */     /* eslint camelcase : ["error", {ignoreDestructuring:true}] */ 

const Lesson_1 = {title:'The Home Row Keys.'},'lesson': 'jjj fff jjj fff'}

Just get the same camelcase error without any change. The eslint documentation says just disable the entire rule but does not specify a method other than listed above.

like image 804
JimFuqua Avatar asked Jul 07 '19 01:07

JimFuqua


People also ask

How do I disable CamelCase Eslint?

The code is short and it does not eliminate the error concerning camel case. Just get the same camelcase error without any change. The eslint documentation says just disable the entire rule but does not specify a method other than listed above.

How do I disable Eslint check?

To temporarily turn off ESLint, you should add a block comment /* eslint-disable */ before the lines that you're interested in: /* eslint-disable */ console.

How do I disable a specific Eslint rule?

If you want to disable an ESLint rule in a file or on a specific line, you can add a comment. On a single line: const message = 'foo'; console. log(message); // eslint-disable-line no-console // eslint-disable-next-line no-console console.

What is the definition of camel case?

What is CamelCase? CamelCase is a way to separate the words in a phrase by making the first letter of each word capitalized and not using spaces. It is commonly used in web URLs, programming and computer naming conventions. It is named after camels because the capital letters resemble the humps on a camel's back.


1 Answers

To disable the rule for a file add next line at the begging of a file:

for JavaScript files:

/* eslint-disable camelcase */ 

for TypeScript with enabled @typescript-eslint plugin:

/* eslint-disable @typescript-eslint/camelcase */ 

To disable the rule for all files in a project add next line to the eslint config file:

for JavaScript files:

rules: {   ...    'camelcase': 'off', } 

for TypeScript with enabled @typescript-eslint plugin:

rules: {   ...    '@typescript-eslint/camelcase': 'off', } 
like image 162
olsydko Avatar answered Oct 12 '22 01:10

olsydko