1.5.16 • Published 6 months ago
@waldronmatt/eslint-config v1.5.16
Eslint Config
My personal shareable eslint configuration.
Install
yarn add -D eslint @waldronmatt/eslint-config
Usage
.eslintrc.js
JS
module.exports = {
extends: '@waldronmatt/eslint-config',
};
TS
module.exports = {
extends: '@waldronmatt/eslint-config/ts',
};
Jest
module.exports = {
extends: '@waldronmatt/eslint-config/jest',
};
Extending
An example configuring a mixed JS/TS, tsconfig
-compatible configuration.
.eslintrc.js
module.exports = {
// ignore linting in dist bundle output folder
ignorePatterns: ['dist/**'],
// enable global variables
env: {
browser: true,
node: true,
jest: true,
}
overrides: [
{
files: ['**/*.ts'],
extends: [
'@waldronmatt/eslint-config/ts',
// add jest linting
'@waldronmatt/eslint-config/jest',
],
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
},
},
{
files: ['**/*.js'],
extends: [
'@waldronmatt/eslint-config',
// add jest linting
'@waldronmatt/eslint-config/jest',
],
},
],
};
Add an NPM Script
Running this command:
npm set-script lint:js "eslint --fix **/*.{js,jsx,ts,tsx}"
Will create:
package.json
"scripts": {
"lint:js": "eslint --fix **/*.{js,jsx,ts,tsx}"
},
Add a Pre-commit Hook
lint-staged.config.js
module.exports = {
'*.{js,jsx,ts,tsx}': ['prettier --cache --write', 'eslint --cache --fix'],
};
Under The Hood
index.js
- Plugins
eslint-plugin-prettier
- Parser
- default
eslint
parser
- default
- Extends
eslint-plugin-unicorn
eslint-plugin-promise
eslint-plugin-sonarjs
eslint-plugin-security
,- default
eslint
ruleset eslint-config-airbnb-base
eslint-config-prettier
- Rules
- Prettier Special Rules
- Other rules can be found in the config
ts.js
- Plugins
@typescript-eslint/eslint-plugin
eslint-plugin-prettier
- Parser
@typescript-eslint/parser
- Extends
eslint-plugin-unicorn
eslint-plugin-promise
eslint-plugin-sonarjs
eslint-plugin-security
,@typescript-eslint/eslint-plugin
eslint-config-airbnb-typescript
eslint-config-prettier
- Rules
- Prettier Special Rules
- Other rules can be found in the config
jest.js
- Plugins
jest
jest-dom
jest-formatting
- Extends
plugin:jest/recommended
plugin:jest-dom/recommended
plugin:jest-formatting/recommended
License
MIT
1.5.16
6 months ago
1.5.14
1 year ago
1.5.15
1 year ago
1.5.12
1 year ago
1.5.13
1 year ago
1.5.10
1 year ago
1.5.11
1 year ago
1.5.9
2 years ago
1.5.8
2 years ago
1.5.5
2 years ago
1.5.4
2 years ago
1.5.7
2 years ago
1.5.6
2 years ago
1.5.3
2 years ago
1.5.2
2 years ago
1.5.1
2 years ago
1.5.0
2 years ago
1.4.0
2 years ago
1.3.0
2 years ago
1.2.0
2 years ago
1.1.8
2 years ago
1.1.7
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.0.9
2 years ago
1.1.6
2 years ago
1.1.5
2 years ago
1.1.4
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.0.10
2 years ago
1.0.12
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago