Socket
Socket
Sign inDemoInstall

eslint

Package Overview
Dependencies
Maintainers
2
Versions
367
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint - npm Package Compare versions

Comparing version 9.9.0 to 9.9.1

lib/services/parser-service.js

35

lib/eslint/eslint.js

@@ -649,2 +649,19 @@ /**

/**
* Creates a fixer function based on the provided fix, fixTypesSet, and config.
* @param {Function|boolean} fix The original fix option.
* @param {Set<string>} fixTypesSet A set of fix types to filter messages for fixing.
* @param {FlatConfig} config The config for the file that generated the message.
* @returns {Function|boolean} The fixer function or the original fix value.
*/
function getFixerForFixTypes(fix, fixTypesSet, config) {
if (!fix || !fixTypesSet) {
return fix;
}
const originalFix = (typeof fix === "function") ? fix : () => true;
return message => shouldMessageBeFixed(message, config, fixTypesSet) && originalFix(message);
}
//-----------------------------------------------------------------------------

@@ -998,13 +1015,4 @@ // Main API

// set up fixer for fixTypes if necessary
let fixer = fix;
const fixer = getFixerForFixTypes(fix, fixTypesSet, config);
if (fix && fixTypesSet) {
// save original value of options.fix in case it's a function
const originalFix = (typeof fix === "function")
? fix : () => true;
fixer = message => shouldMessageBeFixed(message, config, fixTypesSet) && originalFix(message);
}
return retrier.retry(() => fs.readFile(filePath, { encoding: "utf8", signal: controller.signal })

@@ -1113,2 +1121,3 @@ .then(text => {

fix,
fixTypes,
warnIgnored: constructorWarnIgnored,

@@ -1120,4 +1129,8 @@ ruleFilter,

const startTime = Date.now();
const fixTypesSet = fixTypes ? new Set(fixTypes) : null;
const resolvedFilename = path.resolve(cwd, filePath || "__placeholder__.js");
const config = configs.getConfig(resolvedFilename);
const fixer = getFixerForFixTypes(fix, fixTypesSet, config);
// Clear the last used config arrays.

@@ -1140,3 +1153,3 @@ if (resolvedFilename && await this.isPathIgnored(resolvedFilename)) {

cwd,
fix,
fix: fixer,
allowInlineConfig,

@@ -1143,0 +1156,0 @@ ruleFilter,

{
"name": "eslint",
"version": "9.9.0",
"version": "9.9.1",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",

@@ -21,8 +21,8 @@ "description": "An AST-based pattern checker for JavaScript.",

"build:rules-index": "node Makefile.js generateRuleIndexPage",
"lint": "node Makefile.js lint",
"lint:docs:js": "node Makefile.js lintDocsJS",
"lint": "trunk check --no-fix --ignore=docs/**/*.js -a --filter=eslint && trunk check --no-fix --ignore=docs/**/*.js",
"lint:docs:js": "trunk check --no-fix --ignore=** --ignore=!docs/**/*.js -a --filter=eslint && trunk check --no-fix --ignore=** --ignore=!docs/**/*.js",
"lint:docs:rule-examples": "node Makefile.js checkRuleExamples",
"lint:fix": "node Makefile.js lint -- fix",
"lint:fix:docs:js": "node Makefile.js lintDocsJS -- fix",
"lint:unused": "knip",
"lint:fix": "trunk check -y --ignore=docs/**/*.js -a --filter=eslint && trunk check -y --ignore=docs/**/*.js",
"lint:fix:docs:js": "trunk check -y --ignore=** --ignore=!docs/**/*.js -a --flter=eslint && trunk check -y --ignore=** --ignore=!docs/**/*.js",
"release:generate:alpha": "node Makefile.js generatePrerelease -- alpha",

@@ -44,4 +44,4 @@ "release:generate:beta": "node Makefile.js generatePrerelease -- beta",

"lint-staged": {
"*.js": "eslint --fix",
"*.md": "markdownlint --fix",
"*.js": "trunk check --fix --filter=eslint",
"*.md": "trunk check --fix --filter=markdownlint",
"lib/rules/*.js": [

@@ -56,3 +56,3 @@ "node tools/update-eslint-all.js",

],
"docs/**/*.svg": "npx -y svgo -r --multipass"
"docs/**/*.svg": "trunk check --fix --filter=svgo"
},

@@ -74,5 +74,5 @@ "files": [

"@eslint-community/regexpp": "^4.11.0",
"@eslint/config-array": "^0.17.1",
"@eslint/config-array": "^0.18.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "9.9.0",
"@eslint/js": "9.9.1",
"@humanwhocodes/module-importer": "^1.0.1",

@@ -111,10 +111,11 @@ "@humanwhocodes/retry": "^0.3.0",

"@babel/preset-env": "^7.4.3",
"@eslint/core": "^0.3.0",
"@eslint/core": "^0.4.0",
"@eslint/json": "^0.3.0",
"@trunkio/launcher": "^1.3.0",
"@types/estree": "^1.0.5",
"@types/node": "^20.11.5",
"@wdio/browser-runner": "^8.40.1",
"@wdio/cli": "^8.40.0",
"@wdio/concise-reporter": "^8.39.0",
"@wdio/mocha-framework": "^8.40.0",
"@wdio/browser-runner": "^9.0.5",
"@wdio/cli": "^9.0.5",
"@wdio/concise-reporter": "^9.0.4",
"@wdio/mocha-framework": "^9.0.5",
"babel-loader": "^8.0.5",

@@ -130,2 +131,3 @@ "c8": "^7.12.0",

"eslint-plugin-eslint-plugin": "^6.0.0",
"eslint-plugin-yml": "^1.14.0",
"eslint-release": "^3.2.2",

@@ -142,3 +144,2 @@ "eslint-rule-composer": "^0.3.0",

"jiti": "^1.21.6",
"js-yaml": "^4.1.0",
"knip": "^5.21.0",

@@ -149,4 +150,2 @@ "lint-staged": "^11.0.0",

"markdown-it-container": "^3.0.0",
"markdownlint": "^0.34.0",
"markdownlint-cli": "^0.41.0",
"marked": "^4.0.8",

@@ -153,0 +152,0 @@ "metascraper": "^5.25.7",

@@ -24,3 +24,3 @@ [![npm version](https://img.shields.io/npm/v/eslint.svg)](https://www.npmjs.com/package/eslint)

* ESLint uses [Espree](https://github.com/eslint/espree) for JavaScript parsing.
* ESLint uses [Espree](https://github.com/eslint/js/tree/main/packages/espree) for JavaScript parsing.
* ESLint uses an AST to evaluate patterns in code.

@@ -32,14 +32,15 @@ * ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime.

1. [Installation and Usage](#installation-and-usage)
2. [Configuration](#configuration)
3. [Code of Conduct](#code-of-conduct)
4. [Filing Issues](#filing-issues)
5. [Frequently Asked Questions](#frequently-asked-questions)
6. [Releases](#releases)
7. [Security Policy](#security-policy)
8. [Semantic Versioning Policy](#semantic-versioning-policy)
9. [Stylistic Rule Updates](#stylistic-rule-updates)
10. [License](#license)
11. [Team](#team)
12. [Sponsors](#sponsors)
13. [Technology Sponsors](#technology-sponsors) <!-- markdownlint-disable-line MD051 -->
1. [Configuration](#configuration)
1. [Version Support](#version-support)
1. [Code of Conduct](#code-of-conduct)
1. [Filing Issues](#filing-issues)
1. [Frequently Asked Questions](#frequently-asked-questions)
1. [Releases](#releases)
1. [Security Policy](#security-policy)
1. [Semantic Versioning Policy](#semantic-versioning-policy)
1. [Stylistic Rule Updates](#stylistic-rule-updates)
1. [License](#license)
1. [Team](#team)
1. [Sponsors](#sponsors)
1. [Technology Sponsors](#technology-sponsors) <!-- markdownlint-disable-line MD051 -->

@@ -59,3 +60,3 @@ ## Installation and Usage

```shell
./node_modules/.bin/eslint yourfile.js
npx eslint yourfile.js
```

@@ -65,10 +66,17 @@

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:
You can configure rules in your `eslint.config.js` files as in this example:
```js
import pluginJs from "@eslint/js";
export default [ pluginJs.configs.recommended, ];
export default [
{
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
rules: {
"prefer-const": "warn",
"no-constant-binary-expression": "error"
}
}
];
```
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:
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:

@@ -81,5 +89,13 @@ * `"off"` or `0` - turn the rule off

## Version Support
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.
ESLint offers commercial support for both current and previous versions through our partners, [Tidelift][tidelift] and [HeroDevs][herodevs].
See [Version Support](https://eslint.org/version-support) for more details.
## Code of Conduct
ESLint adheres to the [JS Foundation Code of Conduct](https://eslint.org/conduct).
ESLint adheres to the [OpenJS Foundation Code of Conduct](https://eslint.org/conduct).

@@ -97,10 +113,6 @@ ## Filing Issues

### I'm using JSCS, should I migrate to ESLint?
### Does ESLint support JSX?
Yes. [JSCS has reached end of life](https://eslint.org/blog/2016/07/jscs-end-of-life) and is no longer supported.
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.
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.
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.
### Does Prettier replace ESLint?

@@ -110,12 +122,2 @@

### Why can't ESLint find my plugins?
* 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).
* Make sure you have run `npm install` and all your dependencies are installed.
* 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.
### Does ESLint support JSX?
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.
### What ECMAScript versions does ESLint support?

@@ -305,3 +307,3 @@

<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
<p><a href="#"><img src="https://images.opencollective.com/guest-bf377e88/avatar.png" alt="Eli Schleifer" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="#"><img src="https://images.opencollective.com/guest-bf377e88/avatar.png" alt="Eli Schleifer" height="96"></a> <a href="https://opensource.siemens.com"><img src="https://avatars.githubusercontent.com/u/624020?v=4" alt="Siemens" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3>

@@ -314,2 +316,5 @@ <p><a href="https://www.notion.so"><img src="https://images.opencollective.com/notion/bf3b117/logo.png" alt="notion" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://usenextbase.com"><img src="https://avatars.githubusercontent.com/u/145838380?v=4" alt="Nextbase Starter Kit" height="32"></a></p>

<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
<!--techsponsorsend-->
<!--techsponsorsend-->
[tidelift]: https://tidelift.com/funding/github/npm/eslint
[herodevs]: https://www.herodevs.com/support/eslint-nes?utm_source=ESLintWebsite&utm_medium=ESLintWebsite&utm_campaign=ESLintNES&utm_id=ESLintNES

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc