@eslint/js
Advanced tools
| import type { Linter } from "eslint"; | ||
| declare const js: { | ||
| readonly meta: { | ||
| readonly name: string; | ||
| readonly version: string; | ||
| }; | ||
| readonly configs: { | ||
| readonly recommended: { readonly rules: Readonly<Linter.RulesRecord> }; | ||
| readonly all: { readonly rules: Readonly<Linter.RulesRecord> }; | ||
| }; | ||
| }; | ||
| export = js; |
+17
-4
| { | ||
| "name": "@eslint/js", | ||
| "version": "10.0.0", | ||
| "version": "10.0.1", | ||
| "description": "ESLint JavaScript language implementation", | ||
| "funding": "https://eslint.org/donate", | ||
| "main": "./src/index.js", | ||
| "scripts": {}, | ||
| "types": "./types/index.d.ts", | ||
| "scripts": { | ||
| "test:types": "tsc -p tests/types/tsconfig.json" | ||
| }, | ||
| "files": [ | ||
| "LICENSE", | ||
| "README.md", | ||
| "src" | ||
| "src", | ||
| "types" | ||
| ], | ||
@@ -28,5 +33,13 @@ "publishConfig": { | ||
| "license": "MIT", | ||
| "peerDependencies": { | ||
| "eslint": "^10.0.0" | ||
| }, | ||
| "peerDependenciesMeta": { | ||
| "eslint": { | ||
| "optional": true | ||
| } | ||
| }, | ||
| "engines": { | ||
| "node": "^18.18.0 || ^20.9.0 || >=21.1.0" | ||
| "node": "^20.19.0 || ^22.13.0 || >=24" | ||
| } | ||
| } |
+73
-27
| [](https://www.npmjs.com/package/@eslint/js) | ||
| [](https://www.npmjs.com/package/@eslint/js) | ||
| [](https://github.com/eslint/eslint/actions) | ||
| <br> | ||
| [](https://opencollective.com/eslint) | ||
| [](https://opencollective.com/eslint) | ||
| # ESLint JavaScript Plugin | ||
| [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) | ||
| [Website](https://eslint.org) | | ||
| [Configure ESLint](https://eslint.org/docs/latest/use/configure) | | ||
| [Rules](https://eslint.org/docs/rules/) | | ||
| [Contribute to ESLint](https://eslint.org/docs/latest/contribute) | | ||
| [Report Bugs](https://eslint.org/docs/latest/contribute/report-bugs) | | ||
| [Code of Conduct](https://eslint.org/conduct) | | ||
| [X](https://x.com/geteslint) | | ||
| [Discord](https://eslint.org/chat) | | ||
| [Mastodon](https://fosstodon.org/@eslint) | | ||
| [Bluesky](https://bsky.app/profile/eslint.org) | ||
@@ -11,9 +25,29 @@ The beginnings of separating out JavaScript-specific functionality from ESLint. | ||
| * `recommended` - enables the rules recommended by the ESLint team (the replacement for `"eslint:recommended"`) | ||
| * `all` - enables all ESLint rules (the replacement for `"eslint:all"`) | ||
| - `recommended` - enables the rules recommended by the ESLint team (the replacement for `"eslint:recommended"`) | ||
| - `all` - enables all ESLint rules (the replacement for `"eslint:all"`) | ||
| ## Installation | ||
| You can install ESLint using npm or other package managers: | ||
| ```shell | ||
| npm install eslint -D | ||
| # or | ||
| yarn add eslint -D | ||
| # or | ||
| pnpm install eslint -D | ||
| # or | ||
| bun add eslint -D | ||
| ``` | ||
| Then install this plugin: | ||
| ```shell | ||
| npm install @eslint/js -D | ||
| # or | ||
| yarn add @eslint/js -D | ||
| # or | ||
| pnpm install @eslint/js -D | ||
| # or | ||
| bun add @eslint/js -D | ||
| ``` | ||
@@ -26,30 +60,42 @@ | ||
| ```js | ||
| import { defineConfig } from "eslint/config"; | ||
| import js from "@eslint/js"; | ||
| export default [ | ||
| export default defineConfig([ | ||
| // apply recommended rules to JS files | ||
| { | ||
| name: "your-project/recommended-rules", | ||
| files: ["**/*.js"], | ||
| plugins: { | ||
| js, | ||
| }, | ||
| extends: ["js/recommended"], | ||
| }, | ||
| // apply recommended rules to JS files | ||
| { | ||
| files: ["**/*.js"], | ||
| rules: js.configs.recommended.rules | ||
| }, | ||
| // apply recommended rules to JS files with an override | ||
| { | ||
| name: "your-project/recommended-rules-with-override", | ||
| files: ["**/*.js"], | ||
| plugins: { | ||
| js, | ||
| }, | ||
| extends: ["js/recommended"], | ||
| rules: { | ||
| "no-unused-vars": "warn", | ||
| }, | ||
| }, | ||
| // apply recommended rules to JS files with an override | ||
| { | ||
| files: ["**/*.js"], | ||
| rules: { | ||
| ...js.configs.recommended.rules, | ||
| "no-unused-vars": "warn" | ||
| } | ||
| }, | ||
| // apply all rules to JS files | ||
| { | ||
| files: ["**/*.js"], | ||
| rules: { | ||
| ...js.configs.all.rules, | ||
| "no-unused-vars": "warn" | ||
| } | ||
| } | ||
| ] | ||
| // apply all rules to JS files | ||
| { | ||
| name: "your-project/all-rules", | ||
| files: ["**/*.js"], | ||
| plugins: { | ||
| js, | ||
| }, | ||
| extends: ["js/all"], | ||
| rules: { | ||
| "no-unused-vars": "warn", | ||
| }, | ||
| }, | ||
| ]); | ||
| ``` | ||
@@ -56,0 +102,0 @@ |
@@ -7,14 +7,5 @@ /* | ||
| /* eslint quote-props: off -- autogenerated so don't lint */ | ||
| /* | ||
| * IMPORTANT! | ||
| * | ||
| * We cannot add a "name" property to this object because it's still used in eslintrc | ||
| * which doesn't support the "name" property. If we add a "name" property, it will | ||
| * cause an error. | ||
| */ | ||
| module.exports = Object.freeze({ | ||
| "rules": { | ||
| name: "@eslint/js/all", | ||
| rules: Object.freeze({ | ||
| "accessor-pairs": "error", | ||
@@ -155,2 +146,3 @@ "array-callback-return": "error", | ||
| "no-throw-literal": "error", | ||
| "no-unassigned-vars": "error", | ||
| "no-undef": "error", | ||
@@ -203,2 +195,3 @@ "no-undef-init": "error", | ||
| "prefer-template": "error", | ||
| "preserve-caught-error": "error", | ||
| "radix": "error", | ||
@@ -219,3 +212,3 @@ "require-atomic-updates": "error", | ||
| "yoda": "error" | ||
| } | ||
| }) | ||
| }); |
@@ -1,20 +0,9 @@ | ||
| /** | ||
| * @fileoverview Configuration applied when a user configuration extends from | ||
| * eslint:recommended. | ||
| * @author Nicholas C. Zakas | ||
| /* | ||
| * WARNING: This file is autogenerated using the tools/update-eslint-recommended.js | ||
| * script. Do not edit manually. | ||
| */ | ||
| "use strict"; | ||
| /* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */ | ||
| /* | ||
| * IMPORTANT! | ||
| * | ||
| * We cannot add a "name" property to this object because it's still used in eslintrc | ||
| * which doesn't support the "name" property. If we add a "name" property, it will | ||
| * cause an error. | ||
| */ | ||
| module.exports = Object.freeze({ | ||
| name: "@eslint/js/recommended", | ||
| rules: Object.freeze({ | ||
@@ -66,2 +55,3 @@ "constructor-super": "error", | ||
| "no-this-before-super": "error", | ||
| "no-unassigned-vars": "error", | ||
| "no-undef": "error", | ||
@@ -76,2 +66,3 @@ "no-unexpected-multiline": "error", | ||
| "no-unused-vars": "error", | ||
| "no-useless-assignment": "error", | ||
| "no-useless-backreference": "error", | ||
@@ -81,6 +72,7 @@ "no-useless-catch": "error", | ||
| "no-with": "error", | ||
| "preserve-caught-error": "error", | ||
| "require-yield": "error", | ||
| "use-isnan": "error", | ||
| "valid-typeof": "error" | ||
| }) | ||
| }), | ||
| }); |
+10
-4
@@ -8,2 +8,4 @@ /** | ||
| const { name, version } = require("../package.json"); | ||
| //------------------------------------------------------------------------------ | ||
@@ -14,6 +16,10 @@ // Public Interface | ||
| module.exports = { | ||
| configs: { | ||
| all: require("./configs/eslint-all"), | ||
| recommended: require("./configs/eslint-recommended") | ||
| } | ||
| meta: { | ||
| name, | ||
| version, | ||
| }, | ||
| configs: { | ||
| all: require("./configs/eslint-all"), | ||
| recommended: require("./configs/eslint-recommended"), | ||
| }, | ||
| }; |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
15687
10.29%7
16.67%314
2.28%0
-100%104
79.31%1
Infinity%