eslint-config-plus-prettier v4.1.7
eslint-config-plus-prettier
Standard config for ESLint, Prettier and Package Lint. Also includes an optional TSConfig.
Install
npm install --save-dev eslint-config-plus-prettier
Add the following scripts to your package.json
:
"scripts": {
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint --fix",
"lint:check": "eslint",
"package:lint": "npx npm-package-json-lint ."
}
Configure ESLint
Add a eslint.config.js
file with the following:
import config from "eslint-config-plus-prettier";
export default [config];
Consider adding a .eslintignore
file to avoid trying to lint compiled code in the dist
folder:
dist
Configure Prettier
Add prettier config to package.json
:
"prettier": "eslint-config-plus-prettier/prettier"
Consider adding a .prettierignore
file to avoid formatting generated files:
package-lock.json
CHANGELOG.md
Configure Package Lint
Add a .npmpackagejsonlintrc.json
file with the following:
If you are working on a module:
{
"extends": "eslint-config-plus-prettier/packagelint"
}
If you are working on a server, that needs fixed dependencies:
{
"extends": "eslint-config-plus-prettier/packagelint/server"
}
Configure TSConfig (optional)
Add a tsconfig.json
file with the following:
{
"extends": "eslint-config-plus-prettier/tsconfig",
"include": ["src"], // Files to be compiled
"compilerOptions": {
"outDir": "dist" // Compiled directory
}
}
Use
npm run lint
npm run format
npm run package:lint
lint
will check for errors and fix formatting in.ts
and.js
files.format
will apply format rules to all possible files.package:lint
will warn of any inconsistencies in thepackage.json
file.
6 months ago
7 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
1 year ago
12 months ago
12 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago