-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESLint #20
Merged
Merged
ESLint #20
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
arcticicestudio
commented
Nov 17, 2018
Installed all requireded packages (`devDependencies`): - babel-eslint - eslint - eslint-config-arcticicestudio - eslint-plugin-babel - eslint-plugin-import - eslint-plugin-jsx-a11y - eslint-plugin-react >>> Configuration Preset The eslint-config-arcticicestudio (1) configuration preset implements the Arctic Ice Studio JavaScript Style (2). It it built on top of eslint-config-arcticicestudio-base (3) and includes various rules of the following plugins: - eslint-plugin-import (4) - eslint-plugin-jsx-a11y (5) - eslint-plugin-react (6) Since the custom preset is still in major version `0` note that the version range is `>=0.x.x <1.0.0` to avoid NPM's "SemVer Major Zero Caveat". When defining package versions with the the carat `^` or tilde `~` range selector it won't affect packages with a major version of `0`. NPM will resolve these packages to their exact version until the major version is greater or equal to `1`. To avoid this caveat the more detailed version range `>=0.x.x <1.0.0` is used to resolve all versions greater or equal to `0.x.x` but less than `1.0.0`. This will always use the latest `0.x.x` version and removes the need to increment the version manually on each new release. To allow to lint all valid Babel code babel-eslint (7) will be included and specified as main parser (8). Also to make use of the latest Babel features and proposals eslint-plugin-babel (9) has been added. References: (1) https://github.com/arcticicestudio/eslint-config-arcticicestudio (2) https://arcticicestudio.github.io/styleguide-javascript (3) https://github.com/arcticicestudio/eslint-config-arcticicestudio-base (4) https://github.com/benmosher/eslint-plugin-import (5) https://github.com/evcohen/eslint-plugin-jsx-a11y (6) https://github.com/evcohen/eslint-plugin-react (7) https://github.com/babel/babel-eslint (8) https://eslint.org/docs/user-guide/configuring#specifying-parser (9) https://github.com/babel/eslint-plugin-babel GH-15
The `.eslintrc.js` configuration file has been placed in the project root next to the `.eslintignore` file that defines the ignore pattern. It specifies the environments (1) which define global variables that are predefined: - `browser` - browser global variables. - `node` - Node.js global variables and Node.js scoping. References: (1) https://eslint.org/docs/user-guide/configuring#specifying-environments GH-15
The used preset eslint-config-arcticicestudio (1) implements the Arctic Ice Studio JavaScript Style (2). It it built on top of eslint-config-arcticicestudio-base (3) and includes support for rules of the following plugins: - eslint-plugin-import (4) - eslint-plugin-jsx-a11y (5) - eslint-plugin-react (6) >> Disabled rules Due to compatibility problems and message noise the `no-confusing-arrow` rule has been disabled. It can be re-enabled again when the used preset handles the problem or disables the rule too. Also to suppress errors in the future with Gatsby the `import/no-extraneous-dependencies` has been overridden (still error `level`) by adding the `devDependencies` option and add the exception for `./.gatsby/**/*.js`. This allows to use development dependencies in Gatsby configuration files without linting errors since these are necessary and some will be provided by Gatsby itself without being explicitly added to the `package.json`. References: (1) https://github.com/arcticicestudio/eslint-config-arcticicestudio (2) https://arcticicestudio.github.io/styleguide-javascript (3) https://github.com/arcticicestudio/eslint-config-arcticicestudio-base (4) https://github.com/benmosher/eslint-plugin-import (5) https://github.com/evcohen/eslint-plugin-jsx-a11y (6) https://github.com/yannickcr/eslint-plugin-react GH-15
To prepare for a better developer experience with Webpack (that will be used later on through Gatsby) the resolvers of the eslint-plugin-import (1) have been configured for the `src` and `src/components` paths. References: (1) https://github.com/benmosher/eslint-plugin-import#resolvers GH-15
To allow to lint all valid Babel code babel-eslint (1) has been included and specified as main parser (2). References: (1) https://github.com/babel/babel-eslint (2) https://eslint.org/docs/user-guide/configuring#specifying-parser GH-15
To make use of the latest experimental Babel features and proposals eslint-plugin-babel (1) has been added. The following rules have been enabled and configured: - `babel/camelcase` with level `error` - doesn't complain about optional chaining (`let foo = bar?.a_b;`). The core rule `camelcase` (2) has been disabled. - `babel/no-unused-expressions` with level `error` - doesn't fail when using `do` expressions or optional chaining (`a?.b()`). The core rule `no-unused-expressions` (3) has been disabled. References: (1) https://github.com/babel/eslint-plugin-babel (2) https://eslint.org/docs/rules/camelcase (3) https://eslint.org/docs/rules/no-unused-expressions GH-15
To allow to run the JavaScript linting separately a `lint:js` script/task has been added to be included in the main `lint` script flow later on. To use the great auto-fixing feature another `format:js` script/task has been added too. References: (1) https://eslint.org/docs/user-guide/command-line-interface#fixing-problems GH-15
The ignore pattern for dotfiles it automatically applied by ESLint to prevent accidentally lint over paths like ".cache", ".git" or any other critical paths. Explicitly excluding dotfiles from the ignore pattern allows to lint these files. GH-15
It includes an improvement where the `keywords` (1) and `numbers` (1) options of the `quote-props` rule have been disabled since the preset does not target legacy ES3 environments. The deactivation prevents unnecessary and noisy warnings. See the changelog (3) for more details. The package is resolved through the "eslint-config-arcticicestudio" package. References: (1) https://eslint.org/docs/rules/quote-props.html#keywords (2) https://eslint.org/docs/rules/quote-props.html#numbers (3) https://github.com/arcticicestudio/eslint-config-arcticicestudio-base/blob/develop/CHANGELOG.md#050 GH-15
svengreb
approved these changes
Nov 17, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.