Is there any benefit to use JS extension for config files like ESLINT and Stylelint?

824 views Asked by At

I was wondering is there any downside or positive side when creating eslint or stylelint etc files to add the JS prefix to it.

I have noticed you can do it in multiple ways:

a stylelint property in package.json
a .stylelintrc file
a stylelint.config.js file exporting a JS object


.eslintrc
.eslintrc.js

Is there any speed benefit or is one better then the other or is it just personal preference? is one faster or not?

1

There are 1 answers

0
jeddy3 On

Adding an extension makes it easier for editors, like VS Code, to select the correct language for syntax highlighting, autocompletion etc.

  • a .stylelintrc file can contain JSON, YAML or JavaScript.
  • a .eslintrc file can contain JSON or YAML.

This ambiguity isn't good, and the reason that extensionless .eslintrc files are now deprecated in ESLint.

The difference between .stylelintrc.js and stylelint.config.js is purely preference, as is .stylelintrc.json and using a stylelint property in package.json.