diff --git a/.changeset/five-dolphins-taste.md b/.changeset/five-dolphins-taste.md new file mode 100644 index 000000000..80ae9eb3e --- /dev/null +++ b/.changeset/five-dolphins-taste.md @@ -0,0 +1,5 @@ +--- +'@compiled/eslint-plugin': minor +--- + +add engines to formalize supported node versions - ^16.0.0 || >= 18.0.0 diff --git a/.changeset/five-pigs-explain.md b/.changeset/five-pigs-explain.md new file mode 100644 index 000000000..cbd240455 --- /dev/null +++ b/.changeset/five-pigs-explain.md @@ -0,0 +1,5 @@ +--- +'@compiled/eslint-plugin': minor +--- + +support eslint v9 diff --git a/.eslintrc.js b/.eslintrc.js index 171f9dd4d..2159e78b5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,7 +10,7 @@ module.exports = { ecmaFeatures: { jsx: true, }, - ecmaVersion: 2018, + ecmaVersion: 2020, sourceType: 'module', }, plugins: ['react-hooks'], @@ -48,6 +48,8 @@ module.exports = { }, ], 'import/no-unresolved': 'off', + // TypeScript takes care of this for us (https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/namespace.md) + 'import/namespace': 'off', 'import/order': [ 'error', { diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 275aa656c..f215a00b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [14.x, 16.x, 18.x] + node-version: [16.x, 18.x, 20.x, 22.x] steps: - uses: actions/checkout@v3 diff --git a/package.json b/package.json index b51e93004..b177da955 100644 --- a/package.json +++ b/package.json @@ -84,8 +84,9 @@ "@types/react": "^17.0.69", "@types/react-dom": "^17.0.22", "@types/svgo": "^2.6.4", - "@typescript-eslint/eslint-plugin": "^5.59.8", - "@typescript-eslint/parser": "^5.59.8", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", + "@typescript-eslint/utils": "^6.21.0", "babel-loader": "^9.1.2", "eslint": "^8.44.0", "eslint-plugin-import": "^2.27.5", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index e16cfa7aa..8d4a5508f 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -28,10 +28,14 @@ "@types/estraverse": "^5.1.7", "@types/estree": "^1.0.3", "@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": { "registry": "https://registry.npmjs.org/" diff --git a/packages/eslint-plugin/src/rules/jsx-pragma/index.ts b/packages/eslint-plugin/src/rules/jsx-pragma/index.ts index 8049c0f11..6c9ecfa29 100644 --- a/packages/eslint-plugin/src/rules/jsx-pragma/index.ts +++ b/packages/eslint-plugin/src/rules/jsx-pragma/index.ts @@ -8,6 +8,7 @@ import { usesCompiledAPI, } from '../../utils/ast'; import { addImportToDeclaration, removeImportFromDeclaration } from '../../utils/ast-to-string'; +import { getDeclaredVariables, getSourceCode } from '../../utils/context-compat'; import { findJsxImportSourcePragma, findJsxPragma, @@ -75,7 +76,7 @@ function createFixer(context: Rule.RuleContext, source: SourceCode, options: Opt const reactImport = findReactDeclarationWithDefaultImport(source); if (reactImport) { const [declaration, defaultImport] = reactImport; - const [defaultImportVariable] = context.getDeclaredVariables(defaultImport); + const [defaultImportVariable] = getDeclaredVariables(context, defaultImport); if (defaultImportVariable && defaultImportVariable.references.length === 0) { if (declaration.specifiers.length === 1) { @@ -166,7 +167,7 @@ export const jsxPragmaRule: Rule.RuleModule = { importSources: [...DEFAULT_IMPORT_SOURCES, ...(optionsRaw.importSources ?? [])], }; - const source = context.getSourceCode(); + const source = getSourceCode(context); const comments = source.getAllComments(); const compiledImports = findLibraryImportDeclarations(context, options.importSources); diff --git a/packages/eslint-plugin/src/rules/local-cx-xcss/index.ts b/packages/eslint-plugin/src/rules/local-cx-xcss/index.ts index bcd31336f..f39a16fce 100644 --- a/packages/eslint-plugin/src/rules/local-cx-xcss/index.ts +++ b/packages/eslint-plugin/src/rules/local-cx-xcss/index.ts @@ -1,6 +1,7 @@ import type { Rule } from 'eslint'; import { isCxFunction } from '../../utils'; +import { getScope } from '../../utils/context-compat'; function getParentJSXAttribute(node: Rule.Node) { let parent: Rule.Node | null = node.parent; @@ -34,7 +35,7 @@ export const localCXXCSSRule: Rule.RuleModule = { 'CallExpression[callee.name="cx"]': (node: Rule.Node) => { if ( node.type === 'CallExpression' && - isCxFunction(node.callee as Rule.Node, context.getScope().references) + isCxFunction(node.callee as Rule.Node, getScope(context, node).references) ) { const parentJSXAttribute = getParentJSXAttribute(node); const propName = parentJSXAttribute?.name.name.toString(); diff --git a/packages/eslint-plugin/src/rules/no-css-prop-without-css-function/index.ts b/packages/eslint-plugin/src/rules/no-css-prop-without-css-function/index.ts index fc9ccd17d..e9b413fa6 100644 --- a/packages/eslint-plugin/src/rules/no-css-prop-without-css-function/index.ts +++ b/packages/eslint-plugin/src/rules/no-css-prop-without-css-function/index.ts @@ -11,6 +11,7 @@ import { buildImportDeclaration, getImportedName, } from '../../utils/ast-to-string'; +import { getScope, getSourceCode } from '../../utils/context-compat'; type Q = T extends TSESLint.Scope.Definition ? T['type'] extends 'Variable' @@ -39,7 +40,7 @@ class NoCssPropWithoutCssFunctionRunner { constructor(private baseNode: TSESTree.JSXExpressionContainer, private context: Context) { this.jsxElement = traverseUpToJSXOpeningElement(this.baseNode); - this.references = context.getScope().references; + this.references = getScope(context, baseNode).references; this.ignoreIfImported = []; this.excludeReactComponents = false; @@ -125,7 +126,7 @@ class NoCssPropWithoutCssFunctionRunner { private fixWrapper(node: CSSValue, context: Context) { function* fix(fixer: TSESLint.RuleFixer) { const compiledImports = findTSLibraryImportDeclarations(context); - const source = context.getSourceCode(); + const source = getSourceCode(context); // The string that `css` from `@compiled/css` is imported as const cssImportName = getImportedName(compiledImports, 'css'); @@ -220,7 +221,6 @@ export const noCssPropWithoutCssFunctionRule: TSESLint.RuleModule = { meta: { docs: { 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.', }, diff --git a/packages/eslint-plugin/src/rules/no-emotion-css/index.ts b/packages/eslint-plugin/src/rules/no-emotion-css/index.ts index b678b3bce..9c717a768 100644 --- a/packages/eslint-plugin/src/rules/no-emotion-css/index.ts +++ b/packages/eslint-plugin/src/rules/no-emotion-css/index.ts @@ -3,6 +3,7 @@ import type { Rule } from 'eslint'; import type { ImportSpecifier, ImportDeclaration } from 'estree'; import { buildImportDeclaration, buildNamedImport } from '../../utils/ast-to-string'; +import { getSourceCode } from '../../utils/context-compat'; const ALLOWED_EMOTION_IMPORTS = ['css', 'keyframes', 'ClassNames', 'jsx']; @@ -18,8 +19,7 @@ const isEmotionImport = (node: ImportDeclaration) => * @returns {Rule.Node} The `@compiled/react` node or undefined */ const getCompiledNode = (context: Rule.RuleContext) => { - return context - .getSourceCode() + return getSourceCode(context) .ast.body.filter((node): node is ImportDeclaration => node.type === 'ImportDeclaration') .find((node) => node.source.value === COMPILED_IMPORT); }; @@ -39,8 +39,7 @@ export const noEmotionCssRule: Rule.RuleModule = { create(context) { return { Program() { - const pragma = context - .getSourceCode() + const pragma = getSourceCode(context) .getAllComments() .find((n) => n.value.includes('@jsxImportSource @emotion/react')); diff --git a/packages/eslint-plugin/src/rules/no-empty-styled-expression/index.ts b/packages/eslint-plugin/src/rules/no-empty-styled-expression/index.ts index ef624d4c4..b125af9b2 100644 --- a/packages/eslint-plugin/src/rules/no-empty-styled-expression/index.ts +++ b/packages/eslint-plugin/src/rules/no-empty-styled-expression/index.ts @@ -1,6 +1,7 @@ import type { Rule } from 'eslint'; import type { CallExpression, MemberExpression } from 'estree'; +import { getScope } from '../../utils/context-compat'; import { isStyledImportSpecifier } from '../../utils/styled-import'; type RuleModule = Rule.RuleModule; @@ -25,7 +26,7 @@ const createNoEmptyStyledExpressionRule = return { 'CallExpression[callee.type="MemberExpression"]': (node: CallExpression) => { const membEx: MemberExpression = node.callee as MemberExpression; - const { references } = context.getScope(); + const { references } = getScope(context, node); const isStyledImported = membEx.object.type === 'Identifier' && diff --git a/packages/eslint-plugin/src/rules/no-invalid-css-map/index.ts b/packages/eslint-plugin/src/rules/no-invalid-css-map/index.ts index d7eb4d21c..e129d79c2 100644 --- a/packages/eslint-plugin/src/rules/no-invalid-css-map/index.ts +++ b/packages/eslint-plugin/src/rules/no-invalid-css-map/index.ts @@ -3,6 +3,7 @@ import type { Rule } from 'eslint'; import type { CallExpression as ESCallExpression } from 'estree'; import { CssMapObjectChecker, getCssMapObject, isCssMap, validateDefinition } from '../../utils'; +import { getScope, getSourceCode } from '../../utils/context-compat'; type CallExpression = ESCallExpression & Rule.NodeParentExtension; @@ -39,7 +40,7 @@ const reportIfNotTopLevelScope = (node: CallExpression, context: Rule.RuleContex }; const createCssMapRule = (context: Rule.RuleContext): Rule.RuleListener => { - const { text } = context.getSourceCode(); + const { text } = getSourceCode(context); // Bail out if this is not one of the imports we care about (eg. not from @compiled/react) if (DEFAULT_IMPORT_SOURCES.every((source) => !text.includes(source))) { @@ -48,7 +49,7 @@ const createCssMapRule = (context: Rule.RuleContext): Rule.RuleListener => { return { CallExpression(node) { - const references = context.getScope().references; + const references = getScope(context, node).references; if (!isCssMap(node.callee as Rule.Node, references)) { return; diff --git a/packages/eslint-plugin/src/rules/no-js-xcss/index.ts b/packages/eslint-plugin/src/rules/no-js-xcss/index.ts index f7902c540..4372609f1 100644 --- a/packages/eslint-plugin/src/rules/no-js-xcss/index.ts +++ b/packages/eslint-plugin/src/rules/no-js-xcss/index.ts @@ -1,5 +1,7 @@ import type { Rule } from 'eslint'; +import { getFilename } from '../../utils/context-compat'; + export const noJavaScriptXCSSRule: Rule.RuleModule = { meta: { docs: { @@ -17,7 +19,7 @@ export const noJavaScriptXCSSRule: Rule.RuleModule = { create(context) { return { '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({ node: node.name, messageId: 'no-js-xcss', diff --git a/packages/eslint-plugin/src/rules/no-suppress-xcss/index.ts b/packages/eslint-plugin/src/rules/no-suppress-xcss/index.ts index 20ecc3555..7d4c5621e 100644 --- a/packages/eslint-plugin/src/rules/no-suppress-xcss/index.ts +++ b/packages/eslint-plugin/src/rules/no-suppress-xcss/index.ts @@ -1,11 +1,13 @@ import type { Rule } from 'eslint'; +import { getSourceCode } from '../../utils/context-compat'; + function nodeIsTypeSuppressed(context: Rule.RuleContext, node: Rule.Node) { if (!node.loc) { return; } - const comments = context.getSourceCode().getAllComments(); + const comments = getSourceCode(context).getAllComments(); for (const comment of comments) { if (!comment.loc) { diff --git a/packages/eslint-plugin/src/utils/__tests__/context-compat.test.ts b/packages/eslint-plugin/src/utils/__tests__/context-compat.test.ts new file mode 100644 index 000000000..9264e9e0e --- /dev/null +++ b/packages/eslint-plugin/src/utils/__tests__/context-compat.test.ts @@ -0,0 +1,198 @@ +import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import type { Rule, Scope, SourceCode } from 'eslint'; +import type { Node } from 'estree'; + +import { getFilename, getDeclaredVariables, getSourceCode, getScope } from '../context-compat'; + +describe('context-compat', () => { + const node = { obj: 'node' } as unknown as Node; + const tsNode = { obj: 'tsNode' } as unknown as TSESTree.Node; + const scope = { obj: 'scope' } as unknown as Scope.Scope; + const parserServices = { obj: 'parserServices' }; + const variables = [{ name: 'var1' }]; + const sourceCode = { + getDeclaredVariables: jest.fn().mockReturnValue(variables), + getScope: jest.fn().mockReturnValue(scope), + parserServices, + } as unknown as SourceCode; + const tsParserServices = { + tsNodeToESTreeNodeMap: {}, + }; + + describe('getFilename', () => { + it('should prefer context.filename if defined', () => { + const context = { + filename: 'test-file.ts', + getFilename: jest.fn().mockReturnValue('test-file-from-getFilename.ts'), + } as unknown as Rule.RuleContext; + + const result = getFilename(context); + + expect(result).toBe('test-file.ts'); + expect(context.getFilename).not.toHaveBeenCalled(); + }); + + it('should fall back to context.getFilename if context.filename is undefined (v7)', () => { + const context = { + getFilename: jest.fn().mockReturnValue('test-file-from-getFilename.ts'), + } as unknown as Rule.RuleContext; + + const result = getFilename(context); + + expect(result).toBe('test-file-from-getFilename.ts'); + expect(context.getFilename).toHaveBeenCalled(); + }); + }); + + describe('getSourceCode', () => { + it('should prefer context.sourceCode if defined', () => { + const context = { + sourceCode, + getSourceCode: jest.fn(), + } as unknown as Rule.RuleContext; + + const result = getSourceCode(context); + + expect(result).toBe(sourceCode); + expect(context.getSourceCode).not.toHaveBeenCalled(); + }); + + it('should return context.getSourceCode() if context.sourceCode is undefined (v7)', () => { + const context: Rule.RuleContext = { + getSourceCode: jest.fn().mockReturnValue(sourceCode), + } as unknown as Rule.RuleContext; + + const result = getSourceCode(context); + + expect(result).toBe(sourceCode); + expect(context.getSourceCode).toHaveBeenCalled(); + }); + }); + + describe('getDeclaredVariables', () => { + describe('ESLint RuleContext', () => { + it('should prefer sourceCode.getDeclaredVariables if context.sourceCode is defined', () => { + const context = { + sourceCode, + getSourceCode: jest.fn(), + } as unknown as Rule.RuleContext; + + const result = getDeclaredVariables(context, node); + + expect(result).toBe(variables); + expect(context.sourceCode.getDeclaredVariables).toHaveBeenCalledWith(node); + expect(context.getSourceCode).not.toHaveBeenCalled(); + }); + + it('should use getSourceCode().getDeclaredVariables if context.sourceCode is undefined (v7)', () => { + const context = { + getSourceCode: jest.fn().mockReturnValue(sourceCode), + } as unknown as Rule.RuleContext; + + const result = getDeclaredVariables(context, node); + + expect(result).toBe(variables); + expect(sourceCode.getDeclaredVariables).toHaveBeenCalledWith(node); + expect(context.getSourceCode).toHaveBeenCalled(); + }); + }); + + describe('TS ESLint RuleContext', () => { + it('should prefer sourceCode.getDeclaredVariables if context.sourceCode is defined', () => { + const context = { + sourceCode: { + ...sourceCode, + parserServices: tsParserServices, + }, + getSourceCode: jest.fn(), + } as unknown as TSESLint.RuleContext; + + const result = getDeclaredVariables(context, tsNode); + + expect(result).toBe(variables); + expect(context.sourceCode.getDeclaredVariables).toHaveBeenCalledWith(tsNode); + expect(context.getSourceCode).not.toHaveBeenCalled(); + }); + + it('should use getSourceCode().getDeclaredVariables if context.sourceCode is undefined (v7)', () => { + const tsSourceCode = { + ...sourceCode, + parserServices: tsParserServices, + }; + const context = { + getSourceCode: jest.fn().mockReturnValue(tsSourceCode), + } as unknown as TSESLint.RuleContext; + + const result = getDeclaredVariables(context, tsNode); + + expect(result).toBe(variables); + expect(sourceCode.getDeclaredVariables).toHaveBeenCalledWith(tsNode); + expect(context.getSourceCode).toHaveBeenCalled(); + }); + }); + }); + + describe('getScope', () => { + describe('ESLint RuleContext', () => { + it('should prefer sourceCode.getScope when context.soureCode is available', () => { + const context = { + sourceCode, + getScope: jest.fn(), + } as unknown as Rule.RuleContext; + + const result = getScope(context, node); + + expect(result).toBe(scope); + expect(context.sourceCode.getScope).toHaveBeenCalledWith(node); + expect(context.getScope).not.toHaveBeenCalled(); + }); + + it('should use context.getScope when context.sourceCode is undefined (v7)', () => { + const { getScope: mockGetScope, ...sourceCodeWithoutGetScope } = sourceCode; + const context = { + getScope: jest.fn().mockReturnValue(scope), + getSourceCode: jest.fn().mockReturnValue(sourceCodeWithoutGetScope), + } as unknown as Rule.RuleContext; + + const result = getScope(context, node); + + expect(result).toBe(scope); + expect(context.getScope).toHaveBeenCalled(); + }); + }); + + describe('TS ESLint RuleContext', () => { + it('should prefer sourceCode.getScope when context.soureCode is available', () => { + const tsSourceCode = { + ...sourceCode, + parserServices: tsParserServices, + }; + const context = { + sourceCode: tsSourceCode, + getScope: jest.fn(), + } as unknown as TSESLint.RuleContext; + + const result = getScope(context, tsNode); + + expect(result).toBe(scope); + expect(context.sourceCode.getScope).toHaveBeenCalledWith(tsNode); + expect(context.getScope).not.toHaveBeenCalled(); + }); + + it('should use context.getScope when context.sourceCode is undefined (v7)', () => { + const tsSourceCode = { + parserServices: tsParserServices, + }; + const context = { + getScope: jest.fn().mockReturnValue(scope), + getSourceCode: jest.fn().mockReturnValue(tsSourceCode), + } as unknown as TSESLint.RuleContext; + + const result = getScope(context, tsNode); + + expect(result).toBe(scope); + expect(context.getScope).toHaveBeenCalled(); + }); + }); + }); +}); diff --git a/packages/eslint-plugin/src/utils/ast.ts b/packages/eslint-plugin/src/utils/ast.ts index 43a715f23..d4b714ae1 100644 --- a/packages/eslint-plugin/src/utils/ast.ts +++ b/packages/eslint-plugin/src/utils/ast.ts @@ -3,13 +3,7 @@ import type { TSESTree, TSESLint } from '@typescript-eslint/utils'; import type { Rule } from 'eslint'; import type { ImportDeclaration, ImportSpecifier } from 'estree'; -// 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'; /** * Given a rule, return all imports from the libraries defined in `source` @@ -26,14 +20,12 @@ export const findLibraryImportDeclarations = ( context: Rule.RuleContext, sources = DEFAULT_IMPORT_SOURCES ): 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) + ); }; /** diff --git a/packages/eslint-plugin/src/utils/context-compat.ts b/packages/eslint-plugin/src/utils/context-compat.ts new file mode 100644 index 000000000..1e59b963e --- /dev/null +++ b/packages/eslint-plugin/src/utils/context-compat.ts @@ -0,0 +1,86 @@ +import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import type { Rule, Scope, SourceCode } from 'eslint'; +import type { Node } from 'estree'; + +/** + * Note: This compatibility layer is only needed while versions of ESLint earlier than 8.40 + * are supported. Once support for the older versions are dropped, this can (and should) + * go away. + */ + +type RuleContext = Rule.RuleContext; +type TSSourceCode = Readonly; +type TSRuleContext = TSESLint.RuleContext; +type TSVariables = Readonly; + +/** + * Given a rule context, return the SourceCode object in a backwards compatible way. + * This maintains support for ESLint v7 and v8 < 8.40 + * @param context - The rule context object + */ +export const getFilename = (context: RuleContext | TSRuleContext): string => { + return context.filename ?? context.getFilename(); +}; + +const isTSRuleContext = (context: RuleContext | TSRuleContext): context is TSRuleContext => { + const parserServices = getSourceCode(context).parserServices ?? context.parserServices; + + return 'tsNodeToESTreeNodeMap' in parserServices; +}; + +/** + * Given a rule context and the tree node, return the declared variables in a backwards compatible way. + * This maintains support for ESLint v7 and v8 < 8.40 + * @param context - The rule context object + * @param node - Tree node + */ +export function getDeclaredVariables(context: RuleContext, node: Node): Scope.Variable[]; +export function getDeclaredVariables(context: TSRuleContext, node: TSESTree.Node): TSVariables; +export function getDeclaredVariables( + context: RuleContext | TSRuleContext, + node: Node | TSESTree.Node +): Scope.Variable[] | TSVariables { + if (isTSRuleContext(context)) { + return ( + getSourceCode(context).getDeclaredVariables?.(node as TSESTree.Node) ?? + context.getDeclaredVariables(node as TSESTree.Node) + ); + } else { + return ( + getSourceCode(context).getDeclaredVariables?.(node as Node) ?? + context.getDeclaredVariables(node as Node) + ); + } +} + +/** + * Given a rule context, return the SourceCode object in a backwards compatible way. + * This maintains support for ESLint v7 and v8 < 8.40 + * @param context - The rule context object + */ +export const getSourceCode = ( + context: TContext +): TContext extends RuleContext ? SourceCode : TSSourceCode => { + return (context.sourceCode ?? context.getSourceCode()) as TContext extends RuleContext + ? SourceCode + : TSSourceCode; +}; + +/** + * Given a rule context and the tree node, return the scope object in a backwards compatible way. + * This maintains support for ESLint v7 and v8 < 8.40 + * @param context - The rule context object + * @param node - Tree node + */ +export function getScope(context: RuleContext, node: Node): Scope.Scope; +export function getScope(context: TSRuleContext, node: TSESTree.Node): TSESLint.Scope.Scope; +export function getScope( + context: RuleContext | TSRuleContext, + node: Node | TSESTree.Node +): Scope.Scope | TSESLint.Scope.Scope { + if (isTSRuleContext(context)) { + return getSourceCode(context).getScope?.(node as TSESTree.Node) ?? context.getScope(); + } else { + return getSourceCode(context).getScope?.(node as Node) ?? context.getScope(); + } +} diff --git a/packages/eslint-plugin/src/utils/create-no-exported-rule/check-if-compiled-export.ts b/packages/eslint-plugin/src/utils/create-no-exported-rule/check-if-compiled-export.ts index 04e192fde..ecb81ae69 100644 --- a/packages/eslint-plugin/src/utils/create-no-exported-rule/check-if-compiled-export.ts +++ b/packages/eslint-plugin/src/utils/create-no-exported-rule/check-if-compiled-export.ts @@ -1,5 +1,7 @@ import type { Rule, Scope as ScopeNamespace } from 'eslint'; +import { getScope, getSourceCode } from '../context-compat'; + import { isStyledComponent } from './is-styled-component'; type Node = Rule.Node; @@ -13,7 +15,7 @@ type Stack = { }; const getStack = (context: RuleContext, node: Node) => { - const { scopeManager } = context.getSourceCode(); + const { scopeManager } = getSourceCode(context); const stack: Omit = { nodes: [], root: node, @@ -51,7 +53,7 @@ const getStack = (context: RuleContext, node: Node) => { return { ...stack, - scope: scope ?? context.getScope(), + scope: scope ?? getScope(context, node), }; }; @@ -111,7 +113,7 @@ type IsCompiledExport = Yes | No; export const checkIfCompiledExport = ( context: RuleContext, node: Node, - scope: Scope = context.getScope() + scope: Scope = getScope(context, node) ): IsCompiledExport => { // Ignore any expression defined outside of the global or module scope as we have no way of statically analysing them if (scope.type !== 'global' && scope.type !== 'module') { diff --git a/packages/eslint-plugin/src/utils/create-no-exported-rule/index.ts b/packages/eslint-plugin/src/utils/create-no-exported-rule/index.ts index ce2df650f..03a15b781 100644 --- a/packages/eslint-plugin/src/utils/create-no-exported-rule/index.ts +++ b/packages/eslint-plugin/src/utils/create-no-exported-rule/index.ts @@ -1,6 +1,8 @@ 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'; type Node = Rule.Node; @@ -13,14 +15,14 @@ export const createNoExportedRule = messageId: string ): RuleModule['create'] => (context) => { - const { text } = context.getSourceCode(); + const { text } = getSourceCode(context); if (!text.includes(COMPILED_IMPORT)) { return {}; } return { CallExpression(node) { - const { references } = context.getScope(); + const { references } = getScope(context, node); if (!isUsage(node.callee as Rule.Node, references)) { return; } @@ -36,7 +38,7 @@ export const createNoExportedRule = }); }, TaggedTemplateExpression(node) { - const { references } = context.getScope(); + const { references } = getScope(context, node); if (!isUsage(node.tag as Rule.Node, references)) { return; } diff --git a/packages/eslint-plugin/src/utils/create-no-tagged-template-expression-rule/index.ts b/packages/eslint-plugin/src/utils/create-no-tagged-template-expression-rule/index.ts index 17daae449..0270bfd90 100644 --- a/packages/eslint-plugin/src/utils/create-no-tagged-template-expression-rule/index.ts +++ b/packages/eslint-plugin/src/utils/create-no-tagged-template-expression-rule/index.ts @@ -1,5 +1,7 @@ import type { Rule, Scope } from 'eslint'; +import { getScope, getSourceCode } from '../context-compat'; + import { generate } from './generate'; import { getTaggedTemplateExpressionOffset } from './get-tagged-template-expression-offset'; import { toArguments } from './to-arguments'; @@ -16,7 +18,7 @@ export const createNoTaggedTemplateExpressionRule = ): RuleModule['create'] => (context) => ({ TaggedTemplateExpression(node) { - const { references } = context.getScope(); + const { references } = getScope(context, node); if (!isUsage(node.tag as Rule.Node, references)) { return; } @@ -26,7 +28,7 @@ export const createNoTaggedTemplateExpressionRule = node, *fix(fixer: RuleFixer) { const { quasi } = node; - const source = context.getSourceCode(); + const source = getSourceCode(context); // TODO Eventually handle comments instead of skipping them // Skip auto-fixing comments diff --git a/packages/eslint-plugin/src/utils/css-map.ts b/packages/eslint-plugin/src/utils/css-map.ts index 449fbf20e..2081090f9 100644 --- a/packages/eslint-plugin/src/utils/css-map.ts +++ b/packages/eslint-plugin/src/utils/css-map.ts @@ -1,6 +1,8 @@ import type { Rule, Scope } from 'eslint'; import type { CallExpression, Expression, ObjectExpression, Property, Super } from 'estree'; +import { getScope } from './context-compat'; + type Reference = Scope.Reference; type WhitelistedFunction = [packageName: string, functionName: string]; @@ -47,7 +49,7 @@ export class CssMapObjectChecker { this.cssMapObject = cssMapObject; this.report = context.report; - this.references = context.getScope().references; + this.references = getScope(context, cssMapObject).references; } private isNotWhitelistedFunction(callee: Expression | Super) { diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index 094b37a8e..a0ae6a8d7 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "module": "commonjs", + "module": "nodenext", + "moduleResolution": "nodenext", "target": "es2017", "plugins": [ { diff --git a/yarn.lock b/yarn.lock index 63fd8b1f7..b9ef31038 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1524,7 +1524,19 @@ dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.6.1": +"@eslint-community/eslint-utils@^4.4.0": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz#d1145bf2c20132d6400495d6df4bf59362fd9d56" + integrity sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA== + dependencies: + eslint-visitor-keys "^3.4.3" + +"@eslint-community/regexpp@^4.5.1": + version "4.12.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0" + integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ== + +"@eslint-community/regexpp@^4.6.1": version "4.8.0" resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.8.0.tgz#11195513186f68d42fbf449f9a7136b2c0c92005" integrity sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg== @@ -4235,6 +4247,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" integrity sha1-l+3JA36gw4WFMgsolk3eOznkZg0= +"@types/json-schema@^7.0.12": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" @@ -4376,7 +4393,7 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" integrity sha1-GmL4lSVyPd4kuhsBsJK/XfitTTk= -"@types/semver@^7.3.12", "@types/semver@^7.5.0": +"@types/semver@^7.5.0": version "7.5.0" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== @@ -4532,89 +4549,91 @@ resolved "https://registry.yarnpkg.com/@types/yoga-layout/-/yoga-layout-1.9.2.tgz#efaf9e991a7390dc081a0b679185979a83a9639a" integrity sha1-76+emRpzkNwIGgtnkYWXmoOpY5o= -"@typescript-eslint/eslint-plugin@^5.59.8": - version "5.59.8" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.8.tgz#1e7a3e5318ece22251dfbc5c9c6feeb4793cc509" - integrity sha512-JDMOmhXteJ4WVKOiHXGCoB96ADWg9q7efPWHRViT/f09bA8XOMLAVHHju3l0MkZnG1izaWXYmgvQcUjTRcpShQ== +"@typescript-eslint/eslint-plugin@^6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz#30830c1ca81fd5f3c2714e524c4303e0194f9cd3" + integrity sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA== dependencies: - "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.59.8" - "@typescript-eslint/type-utils" "5.59.8" - "@typescript-eslint/utils" "5.59.8" + "@eslint-community/regexpp" "^4.5.1" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/type-utils" "6.21.0" + "@typescript-eslint/utils" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" - grapheme-splitter "^1.0.4" - ignore "^5.2.0" - natural-compare-lite "^1.4.0" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/parser@^5.59.8": - version "5.59.8" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.8.tgz#60cbb00671d86cf746044ab797900b1448188567" - integrity sha512-AnR19RjJcpjoeGojmwZtCwBX/RidqDZtzcbG3xHrmz0aHHoOcbWnpDllenRDmDvsV0RQ6+tbb09/kyc+UT9Orw== - dependencies: - "@typescript-eslint/scope-manager" "5.59.8" - "@typescript-eslint/types" "5.59.8" - "@typescript-eslint/typescript-estree" "5.59.8" + graphemer "^1.4.0" + ignore "^5.2.4" + natural-compare "^1.4.0" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/parser@^6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" + integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ== + dependencies: + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.59.8": - version "5.59.8" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.8.tgz#ff4ad4fec6433647b817c4a7d4b4165d18ea2fa8" - integrity sha512-/w08ndCYI8gxGf+9zKf1vtx/16y8MHrZs5/tnjHhMLNSixuNcJavSX4wAiPf4aS5x41Es9YPCn44MIe4cxIlig== +"@typescript-eslint/scope-manager@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" + integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== dependencies: - "@typescript-eslint/types" "5.59.8" - "@typescript-eslint/visitor-keys" "5.59.8" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" -"@typescript-eslint/type-utils@5.59.8": - version "5.59.8" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.8.tgz#aa6c029a9d7706d26bbd25eb4666398781df6ea2" - integrity sha512-+5M518uEIHFBy3FnyqZUF3BMP+AXnYn4oyH8RF012+e7/msMY98FhGL5SrN29NQ9xDgvqCgYnsOiKp1VjZ/fpA== +"@typescript-eslint/type-utils@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz#6473281cfed4dacabe8004e8521cee0bd9d4c01e" + integrity sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag== dependencies: - "@typescript-eslint/typescript-estree" "5.59.8" - "@typescript-eslint/utils" "5.59.8" + "@typescript-eslint/typescript-estree" "6.21.0" + "@typescript-eslint/utils" "6.21.0" debug "^4.3.4" - tsutils "^3.21.0" + ts-api-utils "^1.0.1" -"@typescript-eslint/types@5.59.8": - version "5.59.8" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.8.tgz#212e54414733618f5d0fd50b2da2717f630aebf8" - integrity sha512-+uWuOhBTj/L6awoWIg0BlWy0u9TyFpCHrAuQ5bNfxDaZ1Ppb3mx6tUigc74LHcbHpOHuOTOJrBoAnhdHdaea1w== +"@typescript-eslint/types@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" + integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== -"@typescript-eslint/typescript-estree@5.59.8": - version "5.59.8" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.8.tgz#801a7b1766481629481b3b0878148bd7a1f345d7" - integrity sha512-Jy/lPSDJGNow14vYu6IrW790p7HIf/SOV1Bb6lZ7NUkLc2iB2Z9elESmsaUtLw8kVqogSbtLH9tut5GCX1RLDg== +"@typescript-eslint/typescript-estree@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" + integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== dependencies: - "@typescript-eslint/types" "5.59.8" - "@typescript-eslint/visitor-keys" "5.59.8" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" + minimatch "9.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" -"@typescript-eslint/utils@5.59.8": - version "5.59.8" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.8.tgz#34d129f35a2134c67fdaf024941e8f96050dca2b" - integrity sha512-Tr65630KysnNn9f9G7ROF3w1b5/7f6QVCJ+WK9nhIocWmx9F+TmCAcglF26Vm7z8KCTwoKcNEBZrhlklla3CKg== +"@typescript-eslint/utils@6.21.0", "@typescript-eslint/utils@^6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134" + integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ== dependencies: - "@eslint-community/eslint-utils" "^4.2.0" - "@types/json-schema" "^7.0.9" - "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.59.8" - "@typescript-eslint/types" "5.59.8" - "@typescript-eslint/typescript-estree" "5.59.8" - eslint-scope "^5.1.1" - semver "^7.3.7" - -"@typescript-eslint/visitor-keys@5.59.8": - version "5.59.8" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.8.tgz#aa6a7ef862add919401470c09e1609392ef3cc40" - integrity sha512-pJhi2ms0x0xgloT7xYabil3SGGlojNNKjK/q6dB3Ey0uJLMjK2UDGJvHieiyJVW/7C3KI+Z4Q3pEHkm4ejA+xQ== - dependencies: - "@typescript-eslint/types" "5.59.8" - eslint-visitor-keys "^3.3.0" + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.12" + "@types/semver" "^7.5.0" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" + semver "^7.5.4" + +"@typescript-eslint/visitor-keys@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" + integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== + dependencies: + "@typescript-eslint/types" "6.21.0" + eslint-visitor-keys "^3.4.1" "@webassemblyjs/ast@1.12.1", "@webassemblyjs/ast@^1.12.1": version "1.12.1" @@ -5954,6 +5973,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + braces@^2.3.1, braces@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" @@ -8446,7 +8472,7 @@ eslint-plugin-react@^7.32.2: semver "^6.3.0" string.prototype.matchall "^4.0.8" -eslint-scope@5.1.1, eslint-scope@^5.1.1: +eslint-scope@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== @@ -10224,6 +10250,11 @@ ignore@^5.1.1, ignore@^5.1.4, ignore@^5.2.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== +ignore@^5.2.4: + version "5.3.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== + immer@8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/immer/-/immer-8.0.1.tgz#9c73db683e2b3975c424fb0572af5889877ae656" @@ -12885,6 +12916,13 @@ minimatch@3.0.4: dependencies: brace-expansion "^1.1.7" +minimatch@9.0.3: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -13111,11 +13149,6 @@ native-url@^0.2.6: dependencies: querystring "^0.2.0" -natural-compare-lite@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" - integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -16206,7 +16239,7 @@ semver-regex@^3.1.2: resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.2.tgz#34b4c0d361eef262e07199dbef316d0f2ab11807" integrity sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA== -"semver@2 || 3 || 4 || 5", semver@7.3.8, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1, semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0, semver@^6.3.1, semver@^7.0.0, semver@^7.1.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3, semver@^7.6.3: +"semver@2 || 3 || 4 || 5", semver@7.3.8, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1, semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0, semver@^6.3.1, semver@^7.0.0, semver@^7.1.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4, semver@^7.6.3: version "7.6.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== @@ -17625,6 +17658,11 @@ trough@^1.0.0: resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406" integrity sha1-uLY5zvrX0LsqvTfUM/+Ck++l9AY= +ts-api-utils@^1.0.1: + version "1.4.3" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.4.3.tgz#bfc2215fe6528fecab2b0fba570a2e8a4263b064" + integrity sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw== + ts-dedent@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ts-dedent/-/ts-dedent-2.1.1.tgz#6dd56870bb5493895171334fa5d7e929107e5bbc" @@ -17680,7 +17718,7 @@ tsconfig-paths@^4.1.2: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== @@ -17690,13 +17728,6 @@ tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.4.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== -tsutils@^3.21.0: - version "3.21.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" - integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== - dependencies: - tslib "^1.8.1" - tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" @@ -17817,7 +17848,7 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.7.0, typescript@^4.9.5: +typescript@^3.7.0, typescript@^4.9.5, typescript@~4.9.5: version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==