@compiled/eslint-plugin
Advanced tools
Comparing version 0.18.2 to 0.19.0
@@ -6,3 +6,3 @@ export declare const name = "/* NAME */"; | ||
readonly 'local-cx-xcss': import("eslint").Rule.RuleModule; | ||
readonly 'no-css-prop-without-css-function': import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<string, [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>; | ||
readonly 'no-css-prop-without-css-function': import("node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<string, [], import("node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>; | ||
readonly 'no-css-tagged-template-expression': import("eslint").Rule.RuleModule; | ||
@@ -28,3 +28,3 @@ readonly 'no-emotion-css': import("eslint").Rule.RuleModule; | ||
readonly 'local-cx-xcss': import("eslint").Rule.RuleModule; | ||
readonly 'no-css-prop-without-css-function': import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<string, [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>; | ||
readonly 'no-css-prop-without-css-function': import("node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<string, [], import("node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>; | ||
readonly 'no-css-tagged-template-expression': import("eslint").Rule.RuleModule; | ||
@@ -31,0 +31,0 @@ readonly 'no-emotion-css': import("eslint").Rule.RuleModule; |
@@ -21,3 +21,3 @@ "use strict"; | ||
exports.name = "@compiled/eslint-plugin"; | ||
exports.version = "0.18.2"; | ||
exports.version = "0.19.0"; | ||
exports.rules = { | ||
@@ -24,0 +24,0 @@ 'jsx-pragma': jsx_pragma_1.jsxPragmaRule, |
@@ -7,2 +7,3 @@ "use strict"; | ||
const ast_to_string_1 = require("../../utils/ast-to-string"); | ||
const context_compat_1 = require("../../utils/context-compat"); | ||
const jsx_1 = require("../../utils/jsx"); | ||
@@ -47,3 +48,3 @@ const getOtherLibraryImports = (context) => { | ||
const [declaration, defaultImport] = reactImport; | ||
const [defaultImportVariable] = context.getDeclaredVariables(defaultImport); | ||
const [defaultImportVariable] = (0, context_compat_1.getDeclaredVariables)(context, defaultImport); | ||
if (defaultImportVariable && defaultImportVariable.references.length === 0) { | ||
@@ -126,3 +127,3 @@ if (declaration.specifiers.length === 1) { | ||
}; | ||
const source = context.getSourceCode(); | ||
const source = (0, context_compat_1.getSourceCode)(context); | ||
const comments = source.getAllComments(); | ||
@@ -129,0 +130,0 @@ const compiledImports = (0, ast_1.findLibraryImportDeclarations)(context, options.importSources); |
@@ -5,2 +5,3 @@ "use strict"; | ||
const utils_1 = require("../../utils"); | ||
const context_compat_1 = require("../../utils/context-compat"); | ||
function getParentJSXAttribute(node) { | ||
@@ -32,3 +33,3 @@ let parent = node.parent; | ||
if (node.type === 'CallExpression' && | ||
(0, utils_1.isCxFunction)(node.callee, context.getScope().references)) { | ||
(0, utils_1.isCxFunction)(node.callee, (0, context_compat_1.getScope)(context, node).references)) { | ||
const parentJSXAttribute = getParentJSXAttribute(node); | ||
@@ -35,0 +36,0 @@ const propName = parentJSXAttribute === null || parentJSXAttribute === void 0 ? void 0 : parentJSXAttribute.name.name.toString(); |
@@ -7,2 +7,3 @@ "use strict"; | ||
const ast_to_string_1 = require("../../utils/ast-to-string"); | ||
const context_compat_1 = require("../../utils/context-compat"); | ||
const findNodeReference = (references, node) => { | ||
@@ -16,3 +17,3 @@ return references.find((reference) => reference.identifier === node); | ||
this.jsxElement = (0, ast_1.traverseUpToJSXOpeningElement)(this.baseNode); | ||
this.references = context.getScope().references; | ||
this.references = (0, context_compat_1.getScope)(context, baseNode).references; | ||
this.ignoreIfImported = []; | ||
@@ -92,3 +93,3 @@ this.excludeReactComponents = false; | ||
const compiledImports = (0, ast_1.findTSLibraryImportDeclarations)(context); | ||
const source = context.getSourceCode(); | ||
const source = (0, context_compat_1.getSourceCode)(context); | ||
// The string that `css` from `@compiled/css` is imported as | ||
@@ -181,3 +182,2 @@ const cssImportName = (0, ast_to_string_1.getImportedName)(compiledImports, 'css'); | ||
url: 'https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-css-prop-without-css-function', | ||
recommended: 'error', | ||
description: 'Disallows `css` prop usages where it is either not wrapped in the `css` import from `@compiled/react` or where `@compiled` cannot determine whether the `css` import is included at build time.', | ||
@@ -184,0 +184,0 @@ }, |
@@ -6,2 +6,3 @@ "use strict"; | ||
const ast_to_string_1 = require("../../utils/ast-to-string"); | ||
const context_compat_1 = require("../../utils/context-compat"); | ||
const ALLOWED_EMOTION_IMPORTS = ['css', 'keyframes', 'ClassNames', 'jsx']; | ||
@@ -17,4 +18,3 @@ const isEmotionStyledImport = (node) => node.source.value === '@emotion/styled'; | ||
const getCompiledNode = (context) => { | ||
return context | ||
.getSourceCode() | ||
return (0, context_compat_1.getSourceCode)(context) | ||
.ast.body.filter((node) => node.type === 'ImportDeclaration') | ||
@@ -38,4 +38,3 @@ .find((node) => node.source.value === utils_1.COMPILED_IMPORT); | ||
Program() { | ||
const pragma = context | ||
.getSourceCode() | ||
const pragma = (0, context_compat_1.getSourceCode)(context) | ||
.getAllComments() | ||
@@ -42,0 +41,0 @@ .find((n) => n.value.includes('@jsxImportSource @emotion/react')); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.noEmptyStyledExpressionRule = void 0; | ||
const context_compat_1 = require("../../utils/context-compat"); | ||
const styled_import_1 = require("../../utils/styled-import"); | ||
@@ -21,3 +22,3 @@ const isEmptyStyledExpression = (node) => { | ||
const membEx = node.callee; | ||
const { references } = context.getScope(); | ||
const { references } = (0, context_compat_1.getScope)(context, node); | ||
const isStyledImported = membEx.object.type === 'Identifier' && | ||
@@ -24,0 +25,0 @@ references.some((reference) => { |
@@ -6,2 +6,3 @@ "use strict"; | ||
const utils_2 = require("../../utils"); | ||
const context_compat_1 = require("../../utils/context-compat"); | ||
const reportIfExported = (node, context) => { | ||
@@ -36,3 +37,3 @@ const state = (0, utils_2.validateDefinition)(context, node); | ||
const createCssMapRule = (context) => { | ||
const { text } = context.getSourceCode(); | ||
const { text } = (0, context_compat_1.getSourceCode)(context); | ||
// Bail out if this is not one of the imports we care about (eg. not from @compiled/react) | ||
@@ -44,3 +45,3 @@ if (utils_1.DEFAULT_IMPORT_SOURCES.every((source) => !text.includes(source))) { | ||
CallExpression(node) { | ||
const references = context.getScope().references; | ||
const references = (0, context_compat_1.getScope)(context, node).references; | ||
if (!(0, utils_2.isCssMap)(node.callee, references)) { | ||
@@ -47,0 +48,0 @@ return; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.noJavaScriptXCSSRule = void 0; | ||
const context_compat_1 = require("../../utils/context-compat"); | ||
exports.noJavaScriptXCSSRule = { | ||
@@ -19,3 +20,3 @@ meta: { | ||
'JSXAttribute[name.name=/[xX]css$/]': (node) => { | ||
if (node.type === 'JSXAttribute' && !context.getFilename().endsWith('.tsx')) { | ||
if (node.type === 'JSXAttribute' && !(0, context_compat_1.getFilename)(context).endsWith('.tsx')) { | ||
context.report({ | ||
@@ -22,0 +23,0 @@ node: node.name, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.noSuppressXCSS = void 0; | ||
const context_compat_1 = require("../../utils/context-compat"); | ||
function nodeIsTypeSuppressed(context, node) { | ||
@@ -8,3 +9,3 @@ if (!node.loc) { | ||
} | ||
const comments = context.getSourceCode().getAllComments(); | ||
const comments = (0, context_compat_1.getSourceCode)(context).getAllComments(); | ||
for (const comment of comments) { | ||
@@ -11,0 +12,0 @@ if (!comment.loc) { |
@@ -5,9 +5,3 @@ "use strict"; | ||
const utils_1 = require("@compiled/utils"); | ||
// WARNING | ||
// context.getSourceCode() is deprecated, but we still use it here because | ||
// the newer alternative, context.sourceCode, is not supported below | ||
// ESLint 8.40. | ||
// | ||
// We can replace this with context.sourceCode once we are certain that | ||
// all Compiled users are using ESLint 8.40+. | ||
const context_compat_1 = require("./context-compat"); | ||
/** | ||
@@ -25,5 +19,3 @@ * Given a rule, return all imports from the libraries defined in `source` | ||
const findLibraryImportDeclarations = (context, sources = utils_1.DEFAULT_IMPORT_SOURCES) => { | ||
return context | ||
.getSourceCode() | ||
.ast.body.filter((node) => node.type === 'ImportDeclaration' && | ||
return (0, context_compat_1.getSourceCode)(context).ast.body.filter((node) => node.type === 'ImportDeclaration' && | ||
typeof node.source.value === 'string' && | ||
@@ -30,0 +22,0 @@ sources.includes(node.source.value)); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.checkIfCompiledExport = void 0; | ||
const context_compat_1 = require("../context-compat"); | ||
const is_styled_component_1 = require("./is-styled-component"); | ||
const getStack = (context, node) => { | ||
const { scopeManager } = context.getSourceCode(); | ||
const { scopeManager } = (0, context_compat_1.getSourceCode)(context); | ||
const stack = { | ||
@@ -35,3 +36,3 @@ nodes: [], | ||
} | ||
return Object.assign(Object.assign({}, stack), { scope: scope !== null && scope !== void 0 ? scope : context.getScope() }); | ||
return Object.assign(Object.assign({}, stack), { scope: scope !== null && scope !== void 0 ? scope : (0, context_compat_1.getScope)(context, node) }); | ||
}; | ||
@@ -72,3 +73,3 @@ const matches = (defs, refs) => { | ||
}; | ||
const checkIfCompiledExport = (context, node, scope = context.getScope()) => { | ||
const checkIfCompiledExport = (context, node, scope = (0, context_compat_1.getScope)(context, node)) => { | ||
var _a; | ||
@@ -75,0 +76,0 @@ // Ignore any expression defined outside of the global or module scope as we have no way of statically analysing them |
@@ -5,5 +5,6 @@ "use strict"; | ||
const utils_1 = require("@compiled/utils"); | ||
const context_compat_1 = require("../context-compat"); | ||
const check_if_compiled_export_1 = require("./check-if-compiled-export"); | ||
const createNoExportedRule = (isUsage, messageId) => (context) => { | ||
const { text } = context.getSourceCode(); | ||
const { text } = (0, context_compat_1.getSourceCode)(context); | ||
if (!text.includes(utils_1.COMPILED_IMPORT)) { | ||
@@ -14,3 +15,3 @@ return {}; | ||
CallExpression(node) { | ||
const { references } = context.getScope(); | ||
const { references } = (0, context_compat_1.getScope)(context, node); | ||
if (!isUsage(node.callee, references)) { | ||
@@ -29,3 +30,3 @@ return; | ||
TaggedTemplateExpression(node) { | ||
const { references } = context.getScope(); | ||
const { references } = (0, context_compat_1.getScope)(context, node); | ||
if (!isUsage(node.tag, references)) { | ||
@@ -32,0 +33,0 @@ return; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createNoTaggedTemplateExpressionRule = void 0; | ||
const context_compat_1 = require("../context-compat"); | ||
const generate_1 = require("./generate"); | ||
@@ -9,3 +10,3 @@ const get_tagged_template_expression_offset_1 = require("./get-tagged-template-expression-offset"); | ||
TaggedTemplateExpression(node) { | ||
const { references } = context.getScope(); | ||
const { references } = (0, context_compat_1.getScope)(context, node); | ||
if (!isUsage(node.tag, references)) { | ||
@@ -19,3 +20,3 @@ return; | ||
const { quasi } = node; | ||
const source = context.getSourceCode(); | ||
const source = (0, context_compat_1.getSourceCode)(context); | ||
// TODO Eventually handle comments instead of skipping them | ||
@@ -22,0 +23,0 @@ // Skip auto-fixing comments |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CssMapObjectChecker = exports.getCssMapObject = void 0; | ||
const context_compat_1 = require("./context-compat"); | ||
const getCssMapObject = (node) => { | ||
@@ -33,3 +34,3 @@ // We assume the argument `node` is already a cssMap() call. | ||
this.report = context.report; | ||
this.references = context.getScope().references; | ||
this.references = (0, context_compat_1.getScope)(context, cssMapObject).references; | ||
} | ||
@@ -36,0 +37,0 @@ isNotWhitelistedFunction(callee) { |
{ | ||
"name": "@compiled/eslint-plugin", | ||
"version": "0.18.2", | ||
"version": "0.19.0", | ||
"description": "A familiar and performant compile time CSS-in-JS library for React.", | ||
@@ -31,7 +31,11 @@ "homepage": "https://compiledcssinjs.com/docs/pkg-eslint-plugin", | ||
"@types/estree-jsx": "^1.0.2", | ||
"@typescript-eslint/parser": "^5.59.8", | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"@typescript-eslint/utils": "^6.21.0", | ||
"eslint": "^8.41.0", | ||
"outdent": "^0.8.0", | ||
"typescript": "^4.9.5" | ||
"typescript": "~4.9.5" | ||
}, | ||
"engines": { | ||
"node": "^16.0.0 || >=18.0.0" | ||
}, | ||
"publishConfig": { | ||
@@ -38,0 +42,0 @@ "registry": "https://registry.npmjs.org/" |
@@ -11,2 +11,3 @@ import { COMPILED_IMPORT, DEFAULT_IMPORT_SOURCES } from '@compiled/utils'; | ||
import { addImportToDeclaration, removeImportFromDeclaration } from '../../utils/ast-to-string'; | ||
import { getDeclaredVariables, getSourceCode } from '../../utils/context-compat'; | ||
import { | ||
@@ -79,3 +80,3 @@ findJsxImportSourcePragma, | ||
const [declaration, defaultImport] = reactImport; | ||
const [defaultImportVariable] = context.getDeclaredVariables(defaultImport); | ||
const [defaultImportVariable] = getDeclaredVariables(context, defaultImport); | ||
@@ -171,3 +172,3 @@ if (defaultImportVariable && defaultImportVariable.references.length === 0) { | ||
const source = context.getSourceCode(); | ||
const source = getSourceCode(context); | ||
const comments = source.getAllComments(); | ||
@@ -174,0 +175,0 @@ |
import type { Rule } from 'eslint'; | ||
import { isCxFunction } from '../../utils'; | ||
import { getScope } from '../../utils/context-compat'; | ||
@@ -37,3 +38,3 @@ function getParentJSXAttribute(node: Rule.Node) { | ||
node.type === 'CallExpression' && | ||
isCxFunction(node.callee as Rule.Node, context.getScope().references) | ||
isCxFunction(node.callee as Rule.Node, getScope(context, node).references) | ||
) { | ||
@@ -40,0 +41,0 @@ const parentJSXAttribute = getParentJSXAttribute(node); |
@@ -14,2 +14,3 @@ import { COMPILED_IMPORT } from '@compiled/utils'; | ||
} from '../../utils/ast-to-string'; | ||
import { getScope, getSourceCode } from '../../utils/context-compat'; | ||
@@ -43,3 +44,3 @@ type Q<T> = T extends TSESLint.Scope.Definition | ||
this.jsxElement = traverseUpToJSXOpeningElement(this.baseNode); | ||
this.references = context.getScope().references; | ||
this.references = getScope(context, baseNode).references; | ||
@@ -130,3 +131,3 @@ this.ignoreIfImported = []; | ||
const compiledImports = findTSLibraryImportDeclarations(context); | ||
const source = context.getSourceCode(); | ||
const source = getSourceCode(context); | ||
@@ -226,3 +227,2 @@ // The string that `css` from `@compiled/css` is imported as | ||
url: 'https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-css-prop-without-css-function', | ||
recommended: 'error', | ||
description: | ||
@@ -229,0 +229,0 @@ 'Disallows `css` prop usages where it is either not wrapped in the `css` import from `@compiled/react` or where `@compiled` cannot determine whether the `css` import is included at build time.', |
@@ -6,2 +6,3 @@ import { COMPILED_IMPORT } from '@compiled/utils'; | ||
import { buildImportDeclaration, buildNamedImport } from '../../utils/ast-to-string'; | ||
import { getSourceCode } from '../../utils/context-compat'; | ||
@@ -22,4 +23,3 @@ const ALLOWED_EMOTION_IMPORTS = ['css', 'keyframes', 'ClassNames', 'jsx']; | ||
const getCompiledNode = (context: Rule.RuleContext) => { | ||
return context | ||
.getSourceCode() | ||
return getSourceCode(context) | ||
.ast.body.filter((node): node is ImportDeclaration => node.type === 'ImportDeclaration') | ||
@@ -44,4 +44,3 @@ .find((node) => node.source.value === COMPILED_IMPORT); | ||
Program() { | ||
const pragma = context | ||
.getSourceCode() | ||
const pragma = getSourceCode(context) | ||
.getAllComments() | ||
@@ -48,0 +47,0 @@ .find((n) => n.value.includes('@jsxImportSource @emotion/react')); |
import type { Rule } from 'eslint'; | ||
import type { CallExpression, MemberExpression } from 'estree'; | ||
import { getScope } from '../../utils/context-compat'; | ||
import { isStyledImportSpecifier } from '../../utils/styled-import'; | ||
@@ -28,3 +29,3 @@ | ||
const membEx: MemberExpression = node.callee as MemberExpression; | ||
const { references } = context.getScope(); | ||
const { references } = getScope(context, node); | ||
@@ -31,0 +32,0 @@ const isStyledImported = |
@@ -6,2 +6,3 @@ import { DEFAULT_IMPORT_SOURCES } from '@compiled/utils'; | ||
import { CssMapObjectChecker, getCssMapObject, isCssMap, validateDefinition } from '../../utils'; | ||
import { getScope, getSourceCode } from '../../utils/context-compat'; | ||
@@ -43,3 +44,3 @@ type CallExpression = ESCallExpression & Rule.NodeParentExtension; | ||
const createCssMapRule = (context: Rule.RuleContext): Rule.RuleListener => { | ||
const { text } = context.getSourceCode(); | ||
const { text } = getSourceCode(context); | ||
@@ -53,3 +54,3 @@ // Bail out if this is not one of the imports we care about (eg. not from @compiled/react) | ||
CallExpression(node) { | ||
const references = context.getScope().references; | ||
const references = getScope(context, node).references; | ||
@@ -56,0 +57,0 @@ if (!isCssMap(node.callee as Rule.Node, references)) { |
import type { Rule } from 'eslint'; | ||
import { getFilename } from '../../utils/context-compat'; | ||
export const noJavaScriptXCSSRule: Rule.RuleModule = { | ||
@@ -20,3 +22,3 @@ meta: { | ||
'JSXAttribute[name.name=/[xX]css$/]': (node: Rule.Node) => { | ||
if (node.type === 'JSXAttribute' && !context.getFilename().endsWith('.tsx')) { | ||
if (node.type === 'JSXAttribute' && !getFilename(context).endsWith('.tsx')) { | ||
context.report({ | ||
@@ -23,0 +25,0 @@ node: node.name, |
import type { Rule } from 'eslint'; | ||
import { getSourceCode } from '../../utils/context-compat'; | ||
function nodeIsTypeSuppressed(context: Rule.RuleContext, node: Rule.Node) { | ||
@@ -8,3 +10,3 @@ if (!node.loc) { | ||
const comments = context.getSourceCode().getAllComments(); | ||
const comments = getSourceCode(context).getAllComments(); | ||
@@ -11,0 +13,0 @@ for (const comment of comments) { |
@@ -6,9 +6,3 @@ import { DEFAULT_IMPORT_SOURCES } from '@compiled/utils'; | ||
// WARNING | ||
// context.getSourceCode() is deprecated, but we still use it here because | ||
// the newer alternative, context.sourceCode, is not supported below | ||
// ESLint 8.40. | ||
// | ||
// We can replace this with context.sourceCode once we are certain that | ||
// all Compiled users are using ESLint 8.40+. | ||
import { getSourceCode } from './context-compat'; | ||
@@ -30,10 +24,8 @@ /** | ||
): ImportDeclaration[] => { | ||
return context | ||
.getSourceCode() | ||
.ast.body.filter( | ||
(node): node is ImportDeclaration => | ||
node.type === 'ImportDeclaration' && | ||
typeof node.source.value === 'string' && | ||
sources.includes(node.source.value) | ||
); | ||
return getSourceCode(context).ast.body.filter( | ||
(node): node is ImportDeclaration => | ||
node.type === 'ImportDeclaration' && | ||
typeof node.source.value === 'string' && | ||
sources.includes(node.source.value) | ||
); | ||
}; | ||
@@ -40,0 +32,0 @@ |
import type { Rule, Scope as ScopeNamespace } from 'eslint'; | ||
import { getScope, getSourceCode } from '../context-compat'; | ||
import { isStyledComponent } from './is-styled-component'; | ||
@@ -16,3 +18,3 @@ | ||
const getStack = (context: RuleContext, node: Node) => { | ||
const { scopeManager } = context.getSourceCode(); | ||
const { scopeManager } = getSourceCode(context); | ||
const stack: Omit<Stack, 'scope'> = { | ||
@@ -55,3 +57,3 @@ nodes: [], | ||
...stack, | ||
scope: scope ?? context.getScope(), | ||
scope: scope ?? getScope(context, node), | ||
}; | ||
@@ -116,3 +118,3 @@ }; | ||
node: Node, | ||
scope: Scope = context.getScope() | ||
scope: Scope = getScope(context, node) | ||
): IsCompiledExport => { | ||
@@ -119,0 +121,0 @@ // Ignore any expression defined outside of the global or module scope as we have no way of statically analysing them |
import { COMPILED_IMPORT } from '@compiled/utils'; | ||
import type { Rule, Scope } from 'eslint'; | ||
import { getScope, getSourceCode } from '../context-compat'; | ||
import { checkIfCompiledExport } from './check-if-compiled-export'; | ||
@@ -16,3 +18,3 @@ | ||
(context) => { | ||
const { text } = context.getSourceCode(); | ||
const { text } = getSourceCode(context); | ||
if (!text.includes(COMPILED_IMPORT)) { | ||
@@ -24,3 +26,3 @@ return {}; | ||
CallExpression(node) { | ||
const { references } = context.getScope(); | ||
const { references } = getScope(context, node); | ||
if (!isUsage(node.callee as Rule.Node, references)) { | ||
@@ -41,3 +43,3 @@ return; | ||
TaggedTemplateExpression(node) { | ||
const { references } = context.getScope(); | ||
const { references } = getScope(context, node); | ||
if (!isUsage(node.tag as Rule.Node, references)) { | ||
@@ -44,0 +46,0 @@ return; |
import type { Rule, Scope } from 'eslint'; | ||
import { getScope, getSourceCode } from '../context-compat'; | ||
import { generate } from './generate'; | ||
@@ -19,3 +21,3 @@ import { getTaggedTemplateExpressionOffset } from './get-tagged-template-expression-offset'; | ||
TaggedTemplateExpression(node) { | ||
const { references } = context.getScope(); | ||
const { references } = getScope(context, node); | ||
if (!isUsage(node.tag as Rule.Node, references)) { | ||
@@ -30,3 +32,3 @@ return; | ||
const { quasi } = node; | ||
const source = context.getSourceCode(); | ||
const source = getSourceCode(context); | ||
@@ -33,0 +35,0 @@ // TODO Eventually handle comments instead of skipping them |
import type { Rule, Scope } from 'eslint'; | ||
import type { CallExpression, Expression, ObjectExpression, Property, Super } from 'estree'; | ||
import { getScope } from './context-compat'; | ||
type Reference = Scope.Reference; | ||
@@ -50,3 +52,3 @@ type WhitelistedFunction = [packageName: string, functionName: string]; | ||
this.report = context.report; | ||
this.references = context.getScope().references; | ||
this.references = getScope(context, cssMapObject).references; | ||
} | ||
@@ -53,0 +55,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
528664
167
12231
9