Skip to content

Update test script #134

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 2 commits into from
Oct 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: Test
strategy:
matrix:
eslint: [7, '8.0.0-0']
eslint: [7, 8]
node: [14, 16]
os: [ubuntu-latest]
include:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"codecov": "^3.1.0",
"cross-spawn": "^6.0.5",
"dts-bundle": "^0.7.3",
"eslint": "^8.0.0-0",
"eslint": "^8.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-jsonc": "^1.4.0",
"eslint-plugin-node": "^11.1.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci-install-eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function sh(command) {
// Install ESLint submodule of the requested version
const installedVersion = require("eslint/package.json").version
cd("test/fixtures/eslint")
if (!installedVersion.startsWith("7.")) {
if (!installedVersion.startsWith("8.")) {
await sh(`git checkout v${installedVersion}`)
}
if (installedVersion.startsWith("5.")) {
Expand Down
17 changes: 9 additions & 8 deletions scripts/update-fixtures-ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function getTree(source, ast) {
type: node.type,
text: source.slice(node.range[0], node.range[1]),
children: [],
})
}),
)
},
leaveNode() {
Expand Down Expand Up @@ -127,7 +127,7 @@ function scopeToJSON(scopeManager) {
reference.resolved &&
reference.resolved.defs &&
reference.resolved.defs[0] &&
reference.resolved.defs[0].name
reference.resolved.defs[0].name,
),
init: reference.init || null,
}
Expand Down Expand Up @@ -225,17 +225,18 @@ for (const name of TARGETS) {
const scopePath = path.join(ROOT, `${name}/scope.json`)
const servicesPath = path.join(ROOT, `${name}/services.json`)
const source = fs.readFileSync(sourcePath, "utf8")
const parserOptions = fs.existsSync(optionsPath)
? JSON.parse(fs.readFileSync(optionsPath, "utf8"))
: {}
const options = Object.assign(
{ filePath: sourcePath },
PARSER_OPTIONS,
fs.existsSync(optionsPath)
? JSON.parse(fs.readFileSync(optionsPath, "utf8"))
: {}
parserOptions,
)
// console.log("Start:", name)
const actual = parser.parseForESLint(source, options)
const tokenRanges = getAllTokens(actual.ast).map((t) =>
source.slice(t.range[0], t.range[1])
source.slice(t.range[0], t.range[1]),
)
const tree = getTree(source, actual.ast)

Expand All @@ -247,13 +248,13 @@ for (const name of TARGETS) {
if (fs.existsSync(scopePath)) {
fs.writeFileSync(
scopePath,
scopeToJSON(actual.scopeManager || analyze(actual.ast, options))
scopeToJSON(actual.scopeManager || analyze(actual.ast, options)),
)
}
if (fs.existsSync(servicesPath)) {
fs.writeFileSync(
servicesPath,
JSON.stringify(Object.keys(actual.services).sort(), null, 4)
JSON.stringify(Object.keys(actual.services).sort(), null, 4),
)
}
}
2 changes: 1 addition & 1 deletion test/fixtures/eslint
Submodule eslint updated 896 files