This is an extension of the Airbnb JavaScript and React style guides and ESLint linter. Overrides, additions and warnings have been added to this document and the project lint configuration.
Note, installing kyt
or setting up a starter-kyt will install this package automatically. If you want to install this linter extension separately, follow these install instructions. If you have kyt
installed and you want to override the linter configuration, skip to step (2).
- Install the eslint-config-kyt node module and its dependencies:
npm install eslint prettier eslint-config-kyt eslint-config-airbnb eslint-plugin-import eslint-plugin-json eslint-plugin-jsx-a11y eslint-plugin-react eslint-config-prettier eslint-plugin-prettier prettier-eslint-cli babel-eslint eslint-plugin-react-hooks --save-dev
- Copy the following into an
.eslintrc
in your project:
{
"extends": "eslint-config-kyt",
"rules": {
/* If you must, override rules here :P */
}
}
If you need to format code in your codebase, run the prettier-eslint command:
node_modules/.bin/prettier-eslint src/**/*.js --write
To keep things formatted as you develop, install an editor package. See more here.
11.1 Don't use iterators. - This eslint rule has been overridden to allow iterators, but using JavaScript higher-order functions is still preferred.
11.2 Don't use generators for now. - This eslint rule has been overridden. It is ok to use generators in node.js but it is advised not to use them on the client-side.
19.2 Additional trailing comma: Yup. eslint: comma-dangle - This eslint rule is overridden for functions to work with older versions of node.
Ordering - Nah.
no-lonely-if - Disallow if as the only statement in an else block.
max-nested-callbacks - Enforces a maximum depth that callbacks can be nested to increase code clarity. (5)
constructor-super - Aimed to flag invalid/missing super() calls.
no-this-before-super - Aimed to flag this/super keywords before super() callings.
prefer-spread - Aimed to flag usage of Function.prototype.apply() that can be replaced with the spread operator.
1.0.0-alpha.2 - 10/23/17
- Upgrades babel-eslint and makes it a proper
peerDependency
1.0.0-alpha.1 - 10/23/17
- Upgrades ESLint and dependencies to 3.19.0 and Prettier to 1.5.2.
0.5.0 - 09/16/17
- Adds rule to restrict server imports. If you have a
src/server
directory, you will need to add this .eslintrc.js into the root of the server directory. This may be a breaking change if you have any server imports in your project from outside of thesrc/server
directory.
0.4.0 - 07/07/17
- Adds Prettier which may be a breaking change as your files might need some minor linting updates. Install Prettier into your favorite editor and/or
node_modules/.bin/prettier-eslint src/**/*.js --write
to apply the updates. If you manually installed, please note the new Prettier modules above that need to be installed. - Upgrades the following eslint plugins:
- eslint-config-airbnb from 14.1.0 to 15.0.2
- eslint-plugin-import from 2.2.0 to 2.7.0
- eslint-plugin-jsxa11y from 4.0.0 to 5.1.1
- eslint-plugin-react from 6.10.0 to 7.1.0
0.3.2 - 04/09/17
Upgrades eslint to version 3.19 for fix below.
- fixes
no-restricted-syntax
error in linter #459.
0.3.1 - 03/27/17
Upgrades eslint to version 3.18 for fix below.
Fixes the following error:
Configuration for rule "no-unused-expressions" is invalid:
Value "data["0"].allowTaggedTemplates" has additional properties.
More here: eslint/eslint#7632
0.3.0 - 03/23/17
This release upgrades linter dependencies, fixing (among other things) no-unused-prop-types
false positives:
- eslint from 3.8.1 to 3.16.1
- eslint-config-airbnb from 12.0.0 to 14.1.0
- eslint-plugin-import from 1.16.0 to 2.2.0
- eslint-plugin-jsxa11y from 2.2.3 to 4.0.0
- eslint-plugin-react from 6.4.1 to 6.10.0
0.2.0 - 02/07/17
dependencies
were converted to peerDependencies
and kyt
now includes the dependencies. If you're using kyt
, then an npm install
should be enough. If you installed this package as a standalone extension then you'll need to follow the Installation instructions and npm install
the named dependencies.
**0.0.1 - 0.1.0 ** - 12/08/16 - life