@merkle-open/eslint-config
v4.0.0
Published
Default configurations for eslint
Downloads
1,012
Readme
ESLint config
Installation
$ npm install --save-dev eslint eslint-plugin-import @merkle-open/eslint-config
Usage Typescript (recommended)
@merkle-open/eslint-config/configurations/typescript-browser
- typescript + browser@merkle-open/eslint-config/configurations/typescript-react
- typescript + react@merkle-open/eslint-config/configurations/typescript-node
- typescript + node
package.json
{
"scripts": {
"lint:ts": "eslint . --ext .jsx,.js,.ts,.tsx"
}
}
Enabling ESLint on TS files in VSCode
You need to update the eslint.validate setting to:
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
]
Usage ES8 (ES2017)
@merkle-open/eslint-config/configurations/es8-browser
- ES8 + browser@merkle-open/eslint-config/configurations/es8-react
- ES8 + react@merkle-open/eslint-config/configurations/es8-node
- ES8 + node
Usage ES7 (ES2016)
@merkle-open/eslint-config/configurations/es7-browser
- ES7 + browser (deprecated)@merkle-open/eslint-config/configurations/es7-react
- ES7 + react (deprecated)@merkle-open/eslint-config/configurations/es7-node
- ES7 + node
Usage ES6 (ES2015) - deprecated
@merkle-open/eslint-config/configurations/es6-browser
- ES6 + browser (deprecated)@merkle-open/eslint-config/configurations/es6-react
- ES6 + react (deprecated)@merkle-open/eslint-config/configurations/es6-node
- ES6 + node (deprecated)
Usage with Prettier
.eslintrc.js (add globals here if needed)
module.exports = {
extends: require.resolve('@merkle-open/eslint-config/configurations/es8-browser.js'),
};
.eslintignore
/.idea/
/node_modules/
package.json
"scripts": {
"lint": "npm run lint:js",
"lint:js": "eslint ."
},
then run npm run lint
Example usage in project tree
- .eslintrc.js (es8-react)
- .eslintignore
- src
- app.jsx
- test
- .eslintrc.js (es8-node)
- index.js
- scripts
- .eslintrc.js (es6-node)
- index.js
Documentation
- Best practices (ES5/6/7/8)
- Style (ES5/6/7/8)
- Variables (ES5/6/7/8)
- Errors (ES5/6/7/8)
- Node (ES5/6/7/8)
- ES6 (ES6/7/8)
- ES8 (ES8)
- Imports (ES6/7/8)
- React (ES6/7/8)
- React A11y (ES6/7/8)
- React hooks (ES6/7/8)
- Typescript (typescript)
Build release
- Create feature or bugfix branch based on master
- Make changes and create pull request, add reviewer, wait for approval
- Merge pull request into master
- Prepare release notes, adjust package.json to next version ([Semantic Versioning](semantic versioning))
- Run
npm publish
(locally) to create npm version - Create and push git tag for version
- Add release notes on GitHub
Thanks to
- Merkle
- ESLint for ESLint and the documentation eslint.org
- Walmart for sharing their config in eslint-config-walmart
- AirBnB for sharing their eslint config in JavaScript Style Guide
License
Changelog
Please see the Releases