forked from mysticatea/eslint-plugin-node
-
-
Notifications
You must be signed in to change notification settings - Fork 55
feat!: drop eslint v7 & node.js < 18 #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
af9d9d3
chore!: switch the configtype to "flat" in rule-tester
aladdin-add f8eba31
fix: alway apply default languageOptions
aladdin-add e89c82b
chore: update tests
aladdin-add 5f2326b
feat!: drop eslint v7 & node.js < 18
aladdin-add 6f2b3bd
fix: replace rule-tester
aladdin-add 7b96327
Apply suggestions from code review
aladdin-add 972d897
chore: a few review suggestions
aladdin-add 35d7a33
build: add timeout
aladdin-add 0ac1a42
build: allow install eslint v9 prereleases
aladdin-add 1e1e5fe
Update .github/workflows/CI.yml
aladdin-add 5f32706
Update CI.yml
aladdin-add b8154d5
chore: use semver
aladdin-add File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
registry=https://registry.npmjs.org/ | ||
registry = https://registry.npmjs.org/ | ||
package-lock = false | ||
force = true | ||
legacy-peer-deps = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @fileoverview Helpers for tests. | ||
* @author 唯然<[email protected]> | ||
*/ | ||
"use strict" | ||
const eslintVersion = require("eslint/package.json").version | ||
const { RuleTester } = require("eslint") | ||
const { FlatRuleTester } = require("eslint/use-at-your-own-risk") | ||
const globals = require("globals") | ||
const semverSatisfies = require("semver/functions/satisfies") | ||
|
||
// greater than or equal to ESLint v9 | ||
exports.gteEslintV9 = semverSatisfies(eslintVersion, ">=9", { | ||
includePrerelease: true, | ||
}) | ||
|
||
exports.FlatRuleTester = exports.gteEslintV9 ? RuleTester : FlatRuleTester | ||
|
||
// to support the `env:{ es6: true, node: true}` rule-tester (env has been away in flat config.) | ||
// * enabled by default as it's most commonly used in the package. | ||
// * to disable the node.js globals: {languageOptions: {env: {node: false}}}. | ||
const defaultConfig = { | ||
languageOptions: { | ||
ecmaVersion: 6, | ||
sourceType: "commonjs", | ||
globals: globals.node, | ||
}, | ||
} | ||
exports.RuleTester = function (config = defaultConfig) { | ||
if (config.languageOptions.env?.node === false) | ||
config.languageOptions.globals = config.languageOptions.globals || {} | ||
delete config.languageOptions.env | ||
|
||
config.languageOptions = Object.assign( | ||
{}, | ||
defaultConfig.languageOptions, | ||
config.languageOptions | ||
) | ||
|
||
const ruleTester = new exports.FlatRuleTester(config) | ||
return ruleTester | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.