Skip to content

Commit

Permalink
compat
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed May 9, 2024
1 parent d3b225c commit c58ee23
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ jobs:
- name: Downgrade ESLint to 7.5.0
run: yarn up eslint@7.5.0
- name: Run babel/eslint tests
run: node ./node_modules/.bin/jest eslint/babel-eslint-parser/ eslint/babel-eslint-plugin/ eslint/babel-eslint-tests/
run: node ./node_modules/.bin/jest eslint

eslint8-test:
name: Test @babel/eslint-* with ESLint 8.0.0
Expand All @@ -553,7 +553,7 @@ jobs:
- name: Downgrade ESLint to 8.0.0
run: yarn up eslint@8.0.0
- name: Run babel/eslint tests
run: node ./node_modules/.bin/jest eslint/babel-eslint-parser/ eslint/babel-eslint-plugin/ eslint/babel-eslint-tests/
run: node ./node_modules/.bin/jest eslint

test262-prepare:
name: test262 - Prepare for running in parallel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ module.exports = {
);
if (!defaultSpecifier) return;

const scope = ctx.sourceCode.getScope(node);
const scope = ctx.sourceCode
? ctx.sourceCode.getScope(node)
: ctx.getScope();

const { name: local } = defaultSpecifier.local;
const { references } = scope.variables.find(v => v.name === local);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module.exports = {
return {
CallExpression(node) {
const { callee } = node;
const scope = context.sourceCode.getScope(node);
const scope = context.sourceCode
? context.sourceCode.getScope(node)
: context.getScope();

const origin = getReferenceOrigin(callee, scope);
if (!origin) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ module.exports = {
return {
CallExpression(node) {
const { callee } = node;
const scope = context.sourceCode.getScope(node);
const scope = context.sourceCode
? context.sourceCode.getScope(node)
: context.getScope();

const origin = getReferenceOrigin(callee, scope);
if (!origin) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ module.exports = {
};

function functionVisitor(node) {
if (!isBabelPluginFactory(node, context.sourceCode.getScope(node))) {
if (
!isBabelPluginFactory(
node,
context.sourceCode
? context.sourceCode.getScope(node)
: context.getScope(),
)
) {
return;
}

Expand Down

0 comments on commit c58ee23

Please sign in to comment.