@eslint/js
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The @eslint/js
is a useful npm package that offers JavaScript-specific functionalities. Born out of the need to separate these functionalities from ESLint, @eslint/js
provides two major configurations:
recommended
- This configuration comprises rules that are highly recommended by the ESLint team. This is essentially a replacement for "eslint:recommended"
.all
- This configuration enables all ESLint rules and it serves as a replacement for "eslint:all"
.These configurations grant you the ability to improve the quality of your JavaScript codebase and adhere to the best practices recommended by the experienced ESLint team.
The usage of @eslint/js
is straightforward and well-documented. You start by installing it in your project using npm. The installation command is npm install @eslint/js -D
. Once it is installed, you can use the configurations in your eslint.config.js
file.
Here are a few examples of how you can use the @eslint/js
configurations in your project:
To apply recommended rules to JavaScript files, you would write:
import js from "@eslint/js";
export default [
{
files: ["**/*.js"],
rules: js.configs.recommended.rules
}
]
You can also apply recommended rules with an override as follows:
import js from "@eslint/js";
export default [
{
files: ["**/*.js"],
rules: {
...js.configs.recommended.rules,
"no-unused-vars": "warn"
}
}
]
To apply all rules to your JavaScript files, the code would look something like this:
import js from "@eslint/js";
export default [
{
files: ["**/*.js"],
rules: {
...js.configs.all.rules,
"no-unused-vars": "warn"
}
}
]
Please note that you can change the rules according to your project’s requirements.
The documentation for the @eslint/js
module is easily available on the ESLint website. The configurational aspects of ESLint can be found here, while a list of the rules it provides can be reviewed here.
To contribute to the development and improvement of @eslint/js
, you can check out the contribution guide here. Remember, every little bit helps in making this module more powerful and user-friendly.