You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After that, you can run ESLint on any file or directory like this:
55
56
56
57
```shell
57
-
./node_modules/.bin/eslint yourfile.js
58
+
npx eslint yourfile.js
58
59
```
59
60
60
61
## Configuration
61
62
62
-
After running `npm init @eslint/config`, you'll have an `eslint.config.js`(or `eslint.config.mjs`) file in your directory. In it, you'll see some rules configured like this:
63
+
You can configure rules in your `eslint.config.js`files as in this example:
63
64
64
65
```js
65
-
importpluginJsfrom"@eslint/js";
66
-
exportdefault [ pluginJs.configs.recommended, ];
66
+
exportdefault [
67
+
{
68
+
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
69
+
rules: {
70
+
"prefer-const":"warn",
71
+
"no-constant-binary-expression":"error"
72
+
}
73
+
}
74
+
];
67
75
```
68
76
69
-
The names `"semi"` and `"quotes"` are the names of [rules](https://eslint.org/docs/rules) in ESLint. The first value is the error level of the rule and can be one of these values:
77
+
The names `"prefer-const"` and `"no-constant-binary-expression"` are the names of [rules](https://eslint.org/docs/rules) in ESLint. The first value is the error level of the rule and can be one of these values:
70
78
71
79
*`"off"` or `0` - turn the rule off
72
80
*`"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code)
73
81
*`"error"` or `2` - turn the rule on as an error (exit code will be 1)
74
82
75
83
The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the [configuration docs](https://eslint.org/docs/latest/use/configure)).
76
84
85
+
## Version Support
86
+
87
+
The ESLint team provides ongoing support for the current version and six months of limited support for the previous version. Limited support includes critical bug fixes, security issues, and compatibility issues only.
88
+
89
+
ESLint offers commercial support for both current and previous versions through our partners, [Tidelift][tidelift] and [HeroDevs][herodevs].
90
+
91
+
See [Version Support](https://eslint.org/version-support) for more details.
92
+
77
93
## Code of Conduct
78
94
79
-
ESLint adheres to the [JS Foundation Code of Conduct](https://eslint.org/conduct).
95
+
ESLint adheres to the [OpenJS Foundation Code of Conduct](https://eslint.org/conduct).
80
96
81
97
## Filing Issues
82
98
@@ -89,28 +105,14 @@ Before filing an issue, please be sure to read the guidelines for what you're re
89
105
90
106
## Frequently Asked Questions
91
107
92
-
### I'm using JSCS, should I migrate to ESLint?
93
-
94
-
Yes. [JSCS has reached end of life](https://eslint.org/blog/2016/07/jscs-end-of-life) and is no longer supported.
95
-
96
-
We have prepared a [migration guide](https://eslint.org/docs/latest/use/migrating-from-jscs) to help you convert your JSCS settings to an ESLint configuration.
108
+
### Does ESLint support JSX?
97
109
98
-
We are now at or near 100% compatibility with JSCS. If you try ESLint and believe we are not yet compatible with a JSCS rule/configuration, please create an issue (mentioning that it is a JSCS compatibility issue) and we will evaluate it as per our normal process.
110
+
Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](https://eslint.org/docs/latest/use/configure)). Please note that supporting JSX syntax *is not* the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics.
99
111
100
112
### Does Prettier replace ESLint?
101
113
102
114
No, ESLint and Prettier have different jobs: ESLint is a linter (looking for problematic patterns) and Prettier is a code formatter. Using both tools is common, refer to [Prettier's documentation](https://prettier.io/docs/en/install#eslint-and-other-linters) to learn how to configure them to work well with each other.
103
115
104
-
### Why can't ESLint find my plugins?
105
-
106
-
* Make sure your plugins (and ESLint) are both in your project's `package.json` as devDependencies (or dependencies, if your project uses ESLint at runtime).
107
-
* Make sure you have run `npm install` and all your dependencies are installed.
108
-
* Make sure your plugins' peerDependencies have been installed as well. You can use `npm view eslint-plugin-myplugin peerDependencies` to see what peer dependencies `eslint-plugin-myplugin` has.
109
-
110
-
### Does ESLint support JSX?
111
-
112
-
Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](https://eslint.org/docs/latest/use/configure)). Please note that supporting JSX syntax *is not* the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics.
113
-
114
116
### What ECMAScript versions does ESLint support?
115
117
116
118
ESLint has full support for ECMAScript 3, 5, and every year from 2015 up until the most recent stage 4 specification (the default). You can set your desired ECMAScript syntax and other settings (like global variables) through [configuration](https://eslint.org/docs/latest/use/configure).
@@ -303,4 +305,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
0 commit comments