]>
Commit | Line | Data |
---|---|---|
f2a92ac6 DC |
1 | [![npm version](https://img.shields.io/npm/v/@eslint/js.svg)](https://www.npmjs.com/package/@eslint/js) |
2 | ||
3 | # ESLint JavaScript Plugin | |
4 | ||
5 | [Website](https://eslint.org) | [Configure ESLint](https://eslint.org/docs/latest/use/configure) | [Rules](https://eslint.org/docs/rules/) | [Contributing](https://eslint.org/docs/latest/contribute) | [Twitter](https://twitter.com/geteslint) | [Chatroom](https://eslint.org/chat) | |
6 | ||
7 | The beginnings of separating out JavaScript-specific functionality from ESLint. | |
8 | ||
9 | Right now, this plugin contains two configurations: | |
10 | ||
11 | * `recommended` - enables the rules recommended by the ESLint team (the replacement for `"eslint:recommended"`) | |
12 | * `all` - enables all ESLint rules (the replacement for `"eslint:all"`) | |
13 | ||
14 | ## Installation | |
15 | ||
16 | ```shell | |
17 | npm install @eslint/js -D | |
18 | ``` | |
19 | ||
20 | ## Usage | |
21 | ||
22 | Use in your `eslint.config.js` file anytime you want to extend one of the configs: | |
23 | ||
24 | ```js | |
25 | import js from "@eslint/js"; | |
26 | ||
27 | export default [ | |
28 | ||
29 | // apply recommended rules to JS files | |
30 | { | |
31 | files: ["**/*.js"], | |
32 | rules: js.configs.recommended.rules | |
33 | }, | |
34 | ||
35 | // apply recommended rules to JS files with an override | |
36 | { | |
37 | files: ["**/*.js"], | |
38 | rules: { | |
39 | ...js.configs.recommended.rules, | |
40 | "no-unused-vars": "warn" | |
41 | } | |
42 | }, | |
43 | ||
44 | // apply all rules to JS files | |
45 | { | |
46 | files: ["**/*.js"], | |
47 | rules: { | |
48 | ...js.configs.all.rules, | |
49 | "no-unused-vars": "warn" | |
50 | } | |
51 | } | |
52 | ] | |
53 | ``` | |
54 | ||
55 | ## License | |
56 | ||
57 | MIT |