1.5.16 • Published 2 years ago
@waldronmatt/eslint-config v1.5.16
Eslint Config
My personal shareable eslint configuration.
Install
yarn add -D eslint @waldronmatt/eslint-configUsage
.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
eslintparser
- default
- Extends
eslint-plugin-unicorneslint-plugin-promiseeslint-plugin-sonarjseslint-plugin-security,- default
eslintruleset eslint-config-airbnb-baseeslint-config-prettier
- Rules
- Prettier Special Rules
- Other rules can be found in the config
ts.js
- Plugins
@typescript-eslint/eslint-plugineslint-plugin-prettier
- Parser
@typescript-eslint/parser
- Extends
eslint-plugin-unicorneslint-plugin-promiseeslint-plugin-sonarjseslint-plugin-security,@typescript-eslint/eslint-plugineslint-config-airbnb-typescripteslint-config-prettier
- Rules
- Prettier Special Rules
- Other rules can be found in the config
jest.js
- Plugins
jestjest-domjest-formatting
- Extends
plugin:jest/recommendedplugin:jest-dom/recommendedplugin:jest-formatting/recommended
License
MIT
1.5.16
2 years ago
1.5.14
3 years ago
1.5.15
3 years ago
1.5.12
3 years ago
1.5.13
3 years ago
1.5.10
3 years ago
1.5.11
3 years ago
1.5.9
3 years ago
1.5.8
3 years ago
1.5.5
3 years ago
1.5.4
3 years ago
1.5.7
3 years ago
1.5.6
3 years ago
1.5.3
3 years ago
1.5.2
3 years ago
1.5.1
3 years ago
1.5.0
3 years ago
1.4.0
3 years ago
1.3.0
3 years ago
1.2.0
3 years ago
1.1.8
3 years ago
1.1.7
3 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.9
4 years ago
1.1.6
4 years ago
1.1.5
4 years ago
1.1.4
4 years ago
1.1.3
4 years ago
1.1.2
4 years ago
1.0.10
4 years ago
1.0.12
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago