Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Oct 8, 2023
1 parent b23d862 commit 932b978
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
53 changes: 48 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,54 @@ module.exports = {
],
"no-restricted-properties": [
"error",
{ object: "context", property: "getSourceCode" },
{ object: "context", property: "getFilename" },
{ object: "context", property: "getCwd" },
{ object: "context", property: "getScope" },
{ object: "context", property: "parserServices" },
{
object: "context",
property: "getSourceCode",
message:
"Please use `eslint-compat-utils` module's `getSourceCode(context).getScope()` instead.",
},
{
object: "context",
property: "sourceCode",
message:
"Please use `eslint-compat-utils` module's `getSourceCode(context).getScope()` instead.",
},
{
object: "context",
property: "getFilename",
message:
"Please use `eslint-compat-utils` module's `getFilename(context)` instead.",
},
{
object: "context",
property: "filename",
message:
"Please use `eslint-compat-utils` module's `getFilename(context)` instead.",
},
{
object: "context",
property: "getCwd",
message:
"Please use `eslint-compat-utils` module's `getCwd(context)` instead.",
},
{
object: "context",
property: "cwd",
message:
"Please use `eslint-compat-utils` module's `getCwd(context)` instead.",
},
{
object: "context",
property: "getScope",
message:
"Please use `eslint-compat-utils` module's `getSourceCode(context).getScope()` instead.",
},
{
object: "context",
property: "parserServices",
message:
"Please use `eslint-compat-utils` module's `getSourceCode(context).parserServices` instead.",
},
],
},
overrides: [
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/auto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getPhysicalFilename, getSourceCode } from "eslint-compat-utils";
import { getFilename, getSourceCode } from "eslint-compat-utils";
import type { RuleListener, RuleModule } from "../types";
import { createRule } from "../utils";
import { getAutoConfig } from "../utils/get-auto-jsonc-rules-config";
Expand All @@ -22,7 +22,7 @@ export default createRule("auto", {
if (!sourceCode.parserServices.isJSON) {
return {};
}
const autoConfig = getAutoConfig(getPhysicalFilename(context));
const autoConfig = getAutoConfig(getFilename(context));

const visitor: RuleListener = {};
for (const ruleId of Object.keys(autoConfig)) {
Expand Down

0 comments on commit 932b978

Please sign in to comment.