|
| 1 | +# @exercism/eslint-config-javascript |
| 2 | + |
| 3 | +This is the shared [`eslint`][web-eslint] configuration used by the [JavaScript track][git-javascript] (for students) and the files contributors and maintainers touch. [Shareable configs][web-shareable-configs] are designed to work with the `extends` feature of `.eslintrc` files. This means you can use the same configuration you're used to on [Exercism][web-exercism] in your on projects! |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +To use the configuration for students, open your [eslint configuration][web-eslint-configuration] file, and add the following value to `extends`. For example, for JSON based configuration files: |
| 8 | + |
| 9 | +```json |
| 10 | +{ |
| 11 | + "extends": "@exercism/eslint-config-javascript" |
| 12 | +} |
| 13 | +``` |
| 14 | + |
| 15 | +To use the configuration used by contributors and maintainers, add the following to `extends`: |
| 16 | + |
| 17 | +```json |
| 18 | +{ |
| 19 | + "extends": "@exercism/eslint-config-javascript/maintainers" |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +## Students configuration |
| 24 | + |
| 25 | +Find the student configuration [here](index.js). It's goal is to help detect and prevent common problems, without making _any_ decisions about code-style. |
| 26 | + |
| 27 | +The rules are based on: |
| 28 | + |
| 29 | +- [`eslint:recommended`][web-eslint-recommended] |
| 30 | +- [`plugin:import`][git-eslint-plugin-import] |
| 31 | +- A few extra rules that catch common issues but are not enabled via the recommended plugin. See [this PR][git-javascript-pr-1094] for a bit of discussion and rationale. |
| 32 | + |
| 33 | +Because the [Exercism JavaScript track][git-javascript] is primarily focussing on running the exercises on Node, only `node` and `es2021` are turned on as environment, but when extending this configuration, you can add more (or turn those off). |
| 34 | + |
| 35 | +## Maintainers configuration |
| 36 | + |
| 37 | +Similar to the students configuration, and found [here](maintainers.js), it also includes the [`prettier` plugin][git-eslint-plugin-prettier] because we use [`prettier`][web-prettier] to achieve consistent code formatting. This plugin turns _off_ rules that conflict with formatting. |
| 38 | + |
| 39 | +Additionally, it doesn't have warnings but errors for most/all of the rules in the students configuration. |
| 40 | + |
| 41 | +## Tooling configuration |
| 42 | + |
| 43 | +Because the tooling (such as the [JavaScript Analyzer][git-javascript-analyzer], [Representer][git-javascript-representer], and [Test Runner][git-javascript-test-runner]) are written in TypeScript, they don't use the same configuration files. If you're looking for those, or to build your own tools in TypeScript, go to [@exercism/eslint-config-tooling][git-eslint-config-tooling]. |
| 44 | + |
| 45 | +[git-eslint-config-tooling]: https://github.com/exercism/eslint-config-tooling |
| 46 | +[git-eslint-plugin-import]: https://github.com/benmosher/eslint-plugin-import |
| 47 | +[git-eslint-plugin-prettier]: https://github.com/prettier/eslint-config-prettier |
| 48 | +[git-javascript]: https://github.com/exercism/javascript |
| 49 | +[git-javascript-analyzer]: https://github.com/exercism/javascript-analyzer |
| 50 | +[git-javascript-pr-1094]: https://github.com/exercism/javascript/pull/1094 |
| 51 | +[git-javascript-representer]: https://github.com/exercism/javascript-representer |
| 52 | +[git-javascript-test-runner]: https://github.com/exercism/javascript-test-runner |
| 53 | +[web-eslint]: https://eslint.org |
| 54 | +[web-eslint-configuration]: https://eslint.org/docs/user-guide/configuring/ |
| 55 | +[web-eslint-recommended]: https://eslint.org/docs/rules/ |
| 56 | +[web-exercism]: https://exercism.io |
| 57 | +[web-prettier]: https://prettier.io |
| 58 | +[web-shareable-configs]: https://eslint.org/docs/developer-guide/shareable-configs |
0 commit comments