Skip to content

Commit

Permalink
update test for v8.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ejahnGithub committed Nov 6, 2024
1 parent 1967af8 commit 2d3ea8b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 12 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 13,
},
env: {
es6: true,
node: true,
},
extends: [require.resolve('./lib/configs/recommended'), 'plugin:eslint-plugin/all'],
plugins: ['eslint-plugin'],
rules: {
'import/extensions': 'off',
'import/no-commonjs': 'off',
'filenames/match-regex': 'off',
'i18n-text/no-en': 'off',
'eslint-plugin/prefer-placeholders': 'off',
'eslint-plugin/test-case-shorthand-strings': 'off',
'eslint-plugin/require-meta-docs-url': 'off',
},
}
5 changes: 4 additions & 1 deletion .github/workflows/eslint-version-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ name: ESLint Compatibility Tests

on: [push, pull_request]

permissions:
contents: read

jobs:
eslint-test:
runs-on: ubuntu-latest

strategy:
matrix:
eslint-version: [8, 9] # Test with ESLint v8 and v9
eslint-version: [8.0.1, 8, 9] # Test with ESLint v8 and v9

steps:
- name: Checkout repository
Expand Down
8 changes: 4 additions & 4 deletions lib/rules/async-currenttarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ module.exports = {

return {
AwaitExpression(node) {
const sourceCode = context.sourceCode
const scope = sourceCode.getScope(node)
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
scopeDidWait.add(scope, true)
},
MemberExpression(node) {
if (node.property && node.property.name === 'currentTarget') {
const sourceCode = context.sourceCode
const scope = sourceCode.getScope(node)
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
if (scope.block.async && scopeDidWait.has(scope)) {
context.report({node, message: 'event.currentTarget inside an async function is error prone'})
}
Expand Down
8 changes: 4 additions & 4 deletions lib/rules/async-preventdefault.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ module.exports = {

return {
AwaitExpression(node) {
const sourceCode = context.sourceCode
const scope = sourceCode.getScope(node)
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)

scopeDidWait.add(scope, true)
},
CallExpression(node) {
if (node.callee.property && node.callee.property.name === 'preventDefault') {
const sourceCode = context.sourceCode
const scope = sourceCode.getScope(node)
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)
if (scope.block.async && scopeDidWait.has(scope)) {
context.report({node, message: 'event.preventDefault() inside an async function is error prone'})
}
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-implicit-buggy-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ module.exports = {
create(context) {
return {
Program(node) {
const sourceCode = context.sourceCode
const scope = sourceCode.getScope(node)
const sourceCode = context.getSourceCode ? context.getSourceCode() : context.sourceCode
const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope(node)

for (const variable of scope.variables) {
if (variable.writeable) {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"lint:eslint-docs": "npm run update:eslint-docs -- --check",
"lint:js": "eslint .",
"pretest": "mkdir -p node_modules/ && ln -fs $(pwd) node_modules/",
"test": "npm run eslint-check && npm run lint && mocha tests/**/*.js tests/**/*.mjs",
"test": "npm run eslint-check && npm run lint && eslint -v && mocha tests/**/*.js tests/**/*.mjs",
"test:8.0.1": "npm install --no-save [email protected] && npm run test",
"test:8": "npm install --no-save eslint@8 && npm run test",
"test:9": "npm install --no-save eslint@9 && npm run test",
"update:eslint-docs": "eslint-doc-generator"
},
"repository": {
Expand Down

0 comments on commit 2d3ea8b

Please sign in to comment.