ESLint Config Automator
ESLint 9+ rules for ESM projects.
Prequisites
- Use Volta to install Node/npm
- If you don't have a
package.json
do npm init -y
first - Run
npm pkg set type=module
- Create an
eslint.config.js
next to the package.json
- Run
npm pkg set scripts.lint="eslint *.js src"
- Change
*.js src
to your files and folders you want to be linted
6. Check the boxes below for what linting rules/plugins you want: Show details
JS TJW JS ESM Import TJW Import Import Alias Vue 2 Vue 3 TJW Vue Vue A11Y TJW JSDoc TJW Jest TJW Vitest
- JavaScript
- JS Official ESLint recommended settings that handle error prevention, but nothing style related
- TJW JS The Jared Wilcurt's Premium JavaScript settings, with stylistic enforcements, for classy, sophisticated developers.
- ESM Imports
- Imports Plugin This plug-in adds many features for detecting issues around ESM imports and exports, including if a variable being exported is imported in other files.
- TJW Import The Jared Wilcurt's settings for the custom rules supplied by the Imports plugin.
- Import Alias Allows defining your own custom file import path aliases so the Imports plugin can resolve them during linting.
- Vue.js Linting
- Vue 2 The official Vue.js 2.x ESLint plugin with custom rules for Vue.
- Vue 3 The official Vue.js 3.x ESLint plugin with custom rules for Vue.
- TJW Vue The Jared Wilcurt's more strict and refined recommended settings for the Vue plugin's rules.
- Vue A11Y A plugin for checking Accessibility issues in Vue components.
- JSDocs
- Unit Testing
- TJW Jest This plugin extends the recommended Jest Lint settings. It adds 5 new custom linting rules exclusive to the library for an improved testing experience.
- TJW Vitest This is the same as TJW Jest, we just make a few tweaks to be compatible with Vitest.
Important:
You will also need to create an empty .eslintrc.cjs
file next to your package.json
, due to a known bug with the import linting plugin.
7. Run this:
8. Put this in your eslint.config.js
:
9. Run npm run lint
Documentation links