简体   繁体   中英

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

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM