Skip to content

Commit 2d3ea8b

Browse files
committed
update test for v8.0.1
1 parent 1967af8 commit 2d3ea8b

File tree

6 files changed

+39
-12
lines changed

6 files changed

+39
-12
lines changed

.eslintrc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
root: true,
3+
parserOptions: {
4+
ecmaVersion: 13,
5+
},
6+
env: {
7+
es6: true,
8+
node: true,
9+
},
10+
extends: [require.resolve('./lib/configs/recommended'), 'plugin:eslint-plugin/all'],
11+
plugins: ['eslint-plugin'],
12+
rules: {
13+
'import/extensions': 'off',
14+
'import/no-commonjs': 'off',
15+
'filenames/match-regex': 'off',
16+
'i18n-text/no-en': 'off',
17+
'eslint-plugin/prefer-placeholders': 'off',
18+
'eslint-plugin/test-case-shorthand-strings': 'off',
19+
'eslint-plugin/require-meta-docs-url': 'off',
20+
},
21+
}

.github/workflows/eslint-version-compatibility.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ name: ESLint Compatibility Tests
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
eslint-test:
710
runs-on: ubuntu-latest
811

912
strategy:
1013
matrix:
11-
eslint-version: [8, 9] # Test with ESLint v8 and v9
14+
eslint-version: [8.0.1, 8, 9] # Test with ESLint v8 and v9
1215

1316
steps:
1417
- name: Checkout repository

lib/rules/async-currenttarget.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ module.exports = {
1313

1414
return {
1515
AwaitExpression(node) {
16-
const sourceCode = context.sourceCode
17-
const scope = sourceCode.getScope(node)
16+
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
17+
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
1818
scopeDidWait.add(scope, true)
1919
},
2020
MemberExpression(node) {
2121
if (node.property && node.property.name === 'currentTarget') {
22-
const sourceCode = context.sourceCode
23-
const scope = sourceCode.getScope(node)
22+
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
23+
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
2424
if (scope.block.async && scopeDidWait.has(scope)) {
2525
context.report({node, message: 'event.currentTarget inside an async function is error prone'})
2626
}

lib/rules/async-preventdefault.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ module.exports = {
1313

1414
return {
1515
AwaitExpression(node) {
16-
const sourceCode = context.sourceCode
17-
const scope = sourceCode.getScope(node)
16+
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
17+
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
1818

1919
scopeDidWait.add(scope, true)
2020
},
2121
CallExpression(node) {
2222
if (node.callee.property && node.callee.property.name === 'preventDefault') {
23-
const sourceCode = context.sourceCode
24-
const scope = sourceCode.getScope(node)
23+
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
24+
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
2525
if (scope.block.async && scopeDidWait.has(scope)) {
2626
context.report({node, message: 'event.preventDefault() inside an async function is error prone'})
2727
}

lib/rules/no-implicit-buggy-globals.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ module.exports = {
1111
create(context) {
1212
return {
1313
Program(node) {
14-
const sourceCode = context.sourceCode
15-
const scope = sourceCode.getScope(node)
14+
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
15+
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
1616

1717
for (const variable of scope.variables) {
1818
if (variable.writeable) {

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
"lint:eslint-docs": "npm run update:eslint-docs -- --check",
1616
"lint:js": "eslint .",
1717
"pretest": "mkdir -p node_modules/ && ln -fs $(pwd) node_modules/",
18-
"test": "npm run eslint-check && npm run lint && mocha tests/**/*.js tests/**/*.mjs",
18+
"test": "npm run eslint-check && npm run lint && eslint -v && mocha tests/**/*.js tests/**/*.mjs",
19+
"test:8.0.1": "npm install --no-save [email protected] && npm run test",
20+
"test:8": "npm install --no-save eslint@8 && npm run test",
21+
"test:9": "npm install --no-save eslint@9 && npm run test",
1922
"update:eslint-docs": "eslint-doc-generator"
2023
},
2124
"repository": {

0 commit comments

Comments
 (0)