ESLint is a code linter for JavaScript.
This configuration combines:
Installation
$ npm install -D eslint-config-standard-prettier-fp eslint@^5.8.0 eslint-config-prettier@^3.0.1 eslint-config-standard@^12.0.0 eslint-import-resolver-node@^0.3.2 eslint-plugin-eslint-comments@^3.0.1 eslint-plugin-filenames@^1.3.2 eslint-plugin-fp@^2.3.0 eslint-plugin-html@^5.0.0-alpha.0 eslint-plugin-import@^2.14.0 eslint-plugin-markdown@^1.0.0-rc.1 eslint-plugin-node@^8.0.0 eslint-plugin-promise@^4.0.1 eslint-plugin-standard@^4.0.0 eslint-plugin-unicorn@^6.0.1 eslint-plugin-you-dont-need-lodash-underscore@^6.4.0 prettier@^1.15.1
Then in your .eslintrc.json
:
{
"extends": "eslint-config-standard-prettier-fp"
}
The configuration is very opinionated but you can override specific rules in
your .eslintrc.json
to fit your needs and coding style.
Then copy the Prettier configuration and .editorconfig
:
$ cp node_modules/eslint-config-standard-prettier-fp/.prettierrc.yml node_modules/eslint-config-standard-prettier-fp/.editorconfig .
Badge
The following badge can be added to your project:
[![eslint-config-standard-prettier-fp](https://img.shields.io/badge/eslint-config--standard--prettier--fp-4cc61e.svg?logo=eslint&logoColor=white)](https://github.com/autoserver-org/eslint-config-standard-prettier-fp)
Prettier
prettier
must be run before eslint
to avoid conflicts.
We recommend using first prettier --write
then eslint --fix --cache
.
Do not forget to add .eslintcache
to your .gitignore
file.
Functional programming
This enforces that state is never directly mutated and global state is not
referenced:
However throwing exceptions are allowed as this can simplify code.
Modularity
The following rules are enforced to encourage splitting your code into small
modules and functions:
Modern JavaScript
Strictness
The configuration is very explicit and enforces strict linting. This should
help you find bugs and maintain a consistent coding style.
This includes:
Other styling rules
HTML and Markdown
eslint-plugin-html and
eslint-plugin-markdown are
included so you can lint JavaScript inside HTML or Markdown files.
Projects using this configuration
- autoserver:
create a full-featured REST/GraphQL API from a configuration file
Feel free to submit an issue or PR to add your project to the list above!