@ouc/eslint-config
v10.0.3
Published
OUC eslint config
Downloads
140
Keywords
Readme
@ouc/eslint-config
This is the ESLint config of @OUC
Dependencies
This config is based on eslint-config-airbnb-typescript.
Installing it
In your new project, do:
npm i --save-dev @ouc/eslint-config \
@typescript-eslint/eslint-plugin@7 \
@typescript-eslint/parser@7 \
@commitlint/cli@19 \
@commitlint/config-conventional@19 \
husky@9 \
eslint@8 \
eslint-config-airbnb@19 \
eslint-config-airbnb-typescript@18 \
eslint-config-async@2 \
eslint-config-prettier@9 \
eslint-import-resolver-typescript@3 \
eslint-plugin-es5@1 \
eslint-plugin-es-x@8 \
eslint-plugin-import@2 \
eslint-plugin-ie11@1 \
eslint-plugin-jsx-a11y@6 \
eslint-plugin-prettier@5 \
eslint-plugin-react@7 \
eslint-plugin-react-hooks@4 \
prettier@3 \
scriptlint@3 \
typescript@5 \
npm-run-all@4
Create the following files in your new project:
.eslintrc.js
module.exports = {
extends: ["@ouc/eslint-config"],
parserOptions: {
project: "./tsconfig.eslint.json",
},
};
.eslintignore
node_modules
dist
volumes
# and whatever else you might want to exclude that has JS/TS files inside
.prettierrc.js
const config = require("@ouc/eslint-config/.prettierrc");
module.exports = config;
.scriptlintrc.js
const config = require("@ouc/eslint-config/.scriptlintrc");
module.exports = config;
commitlint.config.js
const config = require("@ouc/eslint-config/commitlint.config");
module.exports = config;
tsconfig.eslint.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
// make sure to include all the paths here that you also specified in your default tsconfig.json!
}
},
"exclude": [
"node_modules",
],
"include": [
".eslintrc.js",
"*.js",
"*.ts",
"**/*.js",
"**/*.ts",
]
}
Using it
Create the tasks in your package.json, e.g.
{
"scripts": {
"lint": "run-p lint:scriptlint lint:eslint",
"lint:commitlint": "commitlint --edit",
"lint:eslint": "eslint --ext .js,.ts .",
"lint:eslint:fix": "eslint --ext .js,.ts . --fix",
"lint:scriptlint": "scriptlint"
},
}
and create the following husky scripts:
npx husky-init
cp node_modules/@ouc/eslint-config/.husky/commit-msg .husky/commit-msg
cp node_modules/@ouc/eslint-config/.husky/pre-commit .husky/pre-commit
cp node_modules/@ouc/eslint-config/.husky/pre-push .husky/pre-push
chmod +x .husky/commit-msg .husky/pre-commit .husky/pre-push
and start using it :)