Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support ESLint 8.x #14

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 36 additions & 36 deletions .github/workflows/CI.yml
Expand Up @@ -11,39 +11,39 @@ jobs:
name: Keep Latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with: { fetch-depth: 1 }
- name: Install Node.js
uses: actions/setup-node@v1
with: { node-version: 12.x }
- name: Install Packages
run: npm install
- name: Check ESLint Version
uses: ./.github/actions/get-eslint-versions
id: versions
- name: Test
run: npm test
if: success() && steps.versions.outputs.installed != steps.versions.outputs.published
- name: Bump Version
run: |
if ! git diff --exit-code --quiet
then
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "馃敄 ${VERSION}"
git tag "v$VERSION"
git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:master "v${VERSION}"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.versions.outputs.installed }}
if: success() && steps.versions.outputs.installed != steps.versions.outputs.published
- name: Publish
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: success() && steps.versions.outputs.installed != steps.versions.outputs.published
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Packages
run: npm install
- name: Check ESLint Version
uses: ./.github/actions/get-eslint-versions
id: versions
- name: Test
run: npm test
if: success() && steps.versions.outputs.installed != steps.versions.outputs.published
- name: Bump Version
run: |
if ! git diff --exit-code --quiet
then
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "馃敄 ${VERSION}"
git tag "v$VERSION"
git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:master "v${VERSION}"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.versions.outputs.installed }}
if: success() && steps.versions.outputs.installed != steps.versions.outputs.published
- name: Publish
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: success() && steps.versions.outputs.installed != steps.versions.outputs.published
2 changes: 1 addition & 1 deletion .last-version
@@ -1 +1 @@
7.32.0
8.0.0
52 changes: 26 additions & 26 deletions package.json
@@ -1,58 +1,58 @@
{
"name": "eslint4b",
"version": "7.32.0",
"version": "8.0.0",
"description": "ESLint which works in browsers.",
"engines": {
"node": "^10.12.0 || >=12.0.0"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"main": "dist/index.js",
"files": [
"dist"
],
"dependencies": {
"debug": "^4.0.1",
"debug": "^4.3.2",
"doctrine": "^3.0.0",
"escape-string-regexp": "^4.0.0",
"eslint-scope": "^5.1.1",
"eslint-utils": "^2.1.0",
"eslint-visitor-keys": "^2.0.0",
"espree": "^7.3.1",
"eslint-scope": "^6.0.0",
"eslint-utils": "^3.0.0",
"eslint-visitor-keys": "^3.0.0",
"espree": "^9.0.0",
"esquery": "^1.4.0",
"esutils": "^2.0.2",
"esutils": "^2.0.3",
"functional-red-black-tree": "^1.0.1",
"globals": "^13.6.0",
"globals": "^13.11.0",
"ignore": "^4.0.6",
"levn": "^0.4.1",
"lodash.merge": "^4.6.2",
"natural-compare": "^1.4.0",
"regexpp": "^3.1.0"
"regexpp": "^3.2.0"
},
"devDependencies": {
"@actions/core": "^1.2.4",
"@babel/core": "^7.9.6",
"@mysticatea/eslint-plugin": "^11.0.0",
"@types/node": "^12.12.38",
"@actions/core": "^1.5.0",
"@babel/core": "^7.15.0",
"@mysticatea/eslint-plugin": "^13.0.0",
"@types/node": "^12.20.20",
"babel-plugin-minify-constant-folding": "^0.5.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"eslint": "^7.0.0",
"eslint": "^8.0.0",
"fancy-log": "^1.3.3",
"fs-extra": "^9.0.0",
"karma": "^5.0.5",
"karma-chrome-launcher": "^3.0.0",
"fs-extra": "^9.1.0",
"karma": "^5.2.3",
"karma-chrome-launcher": "^3.1.0",
"karma-mocha": "^1.3.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-sourcemap-loader": "^0.3.8",
"karma-webpack": "^4.0.2",
"mocha": "^6.2.3",
"p-event": "^4.1.0",
"puppeteer": "^1.18.1",
"rollup": "^2.8.2",
"rollup-plugin-commonjs": "^10.0.1",
"p-event": "^4.2.0",
"puppeteer": "^1.20.0",
"rollup": "^2.56.2",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-re": "^1.0.7",
"rollup-plugin-sourcemaps": "^0.6.2",
"semver": "^7.3.2",
"webpack": "^4.43.0"
"rollup-plugin-sourcemaps": "^0.6.3",
"semver": "^7.3.5",
"webpack": "^4.46.0"
},
"scripts": {
"build": "node scripts/build",
Expand Down
21 changes: 4 additions & 17 deletions scripts/build.js
Expand Up @@ -6,6 +6,7 @@

const path = require("path")
const babel = require("@babel/core")
const { builtinRules } = require("eslint/use-at-your-own-risk");
const log = require("fancy-log")
const fs = require("fs-extra")
const rollup = require("rollup")
Expand All @@ -30,26 +31,13 @@ const resolve = require("./rollup-plugin/resolve")
//--------------------------------------------------------------------------
log.info("Update 'scripts/shim/core-rules.js'.")

const ruleDir = path.resolve("node_modules/eslint/lib/rules")
const ruleIds = (await fs.readdir(ruleDir))
.filter(
filename =>
/^[a-z-]+\.js$/u.test(filename) && filename !== "index.js",
)
.map(filename => path.basename(filename, ".js"))
const importDecls = ruleIds
.map(
(ruleId, index) =>
`import _${index} from "eslint/lib/rules/${ruleId}"`,
)
.join("\n")
const exportDecls = ruleIds
.map((ruleId, index) => ` "${ruleId}": _${index},`)
const exportDecls = [...builtinRules.keys()]
.map((ruleId) => ` "${ruleId}": builtinRules.get("${ruleId}"),`)
.join("\n")

await fs.writeFile(
"scripts/shim/core-rules.js",
`${importDecls}\nexport default {\n${exportDecls}\n}\n`,
`const { builtinRules } = require("eslint/use-at-your-own-risk")\nexport default {\n${exportDecls}\n}\n`,
)

//--------------------------------------------------------------------------
Expand Down Expand Up @@ -81,7 +69,6 @@ const resolve = require("./rollup-plugin/resolve")
plugins: [
replace({
debug: "./scripts/shim/debug.js",
"eslint/lib/rules/index.js": "./scripts/shim/rules-index.js",
}),
resolve(),
modify({
Expand Down
2 changes: 1 addition & 1 deletion scripts/shim/index.js
@@ -1,4 +1,4 @@
import { Linter as BaseLinter } from "eslint/lib/linter"
import { Linter as BaseLinter } from "eslint"
import coreRules from "./core-rules"

/**
Expand Down
2 changes: 1 addition & 1 deletion scripts/shim/linter.js
@@ -1,2 +1,2 @@
import { Linter } from "eslint/lib/linter"
import { Linter } from "eslint"
export default Linter