After migration to eslint from 8 to 9.8 I get an error, but according to Develop - Get started - Atlassian Design System
“Atlassians are required to use the latest version of ESLint, and we strongly recommend it for anyone using design system packages.”
The error:
Oops! Something went wrong!
ESLint: 9.8.0
TypeError: context.getScope is not a function
Occurred while linting /Users/prem/dev/example-app/app/src/index.tsx:15
Rule: "@atlaskit/ui-styling-standard/convert-props-syntax"
at /Users/prem/dev/example-app/app/node_modules/@atlaskit/eslint-plugin-ui-styling-standard/dist/cjs/rules/convert-props-syntax/index.js:398:34
and the failing code is @atlaskit/eslint-plugin-ui-styling-standard/dist/cjs/rules/convert-props-syntax/index.js:398:34
create: function create(context) {
return {
CallExpression: function (_CallExpression) {
function CallExpression(_x) {
return _CallExpression.apply(this, arguments);
}
CallExpression.toString = function () {
return _CallExpression.toString();
};
return CallExpression;
}(function (node) {
var _node$parent, _node$parent2;
var references = context.getScope().references;
eslint 9x config eslint.config.mjs
import path from "node:path"
import globals from "globals"
import js from "@eslint/js"
import react from "eslint-plugin-react"
import tsParser from "@typescript-eslint/parser"
import typescriptEslint from "@typescript-eslint/eslint-plugin"
import prettier from "eslint-plugin-prettier"
import unusedImports from "eslint-plugin-unused-imports"
import reactHooks from "eslint-plugin-react-hooks"
import { fileURLToPath } from "node:url"
import { FlatCompat } from "@eslint/eslintrc"
import { fixupPluginRules } from "@eslint/compat"
import designSystem from "@atlaskit/eslint-plugin-design-system"
import uiStylingStandard from "@atlaskit/eslint-plugin-ui-styling-standard"
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [{
ignores: [
"**/node_modules",
"**/dist",
"src/generated/**/*",
"src/reportWebVitals.js",
],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:react/recommended",
"plugin:@atlaskit/ui-styling-standard/recommended",
"plugin:@atlaskit/design-system/recommended",
), {
plugins: {
react,
prettier,
"@typescript-eslint": typescriptEslint,
"unused-imports": unusedImports,
"react-hooks": fixupPluginRules(reactHooks),
"@atlaskit/ui-styling-standard": uiStylingStandard,
"@atlaskit/design-system": designSystem,
},
languageOptions: {
ecmaVersion: 2015,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
},
parser: tsParser,
},
settings: {
react: {
version: "detect", // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
rules: {
"no-console": 1,
"prettier/prettier": ["warn"],
"@typescript-eslint/ban-types": ["warn"],
"@typescript-eslint/no-empty-function": ["error"],
"@typescript-eslint/no-explicit-any": "error",
"no-class-assign": ["error"],
"no-compare-neg-zero": ["error"],
"no-cond-assign": ["error"],
"no-const-assign": ["error"],
"no-constant-condition": ["error"],
"no-control-regex": ["error"],
"no-debugger": ["error"],
"no-dupe-args": ["error"],
"no-dupe-class-members": ["error"],
"no-dupe-else-if": ["error"],
"no-dupe-keys": ["error"],
"no-duplicate-case": ["error"],
"no-duplicate-imports": ["error"],
"no-empty-character-class": ["error"],
"no-empty-pattern": ["error"],
"no-ex-assign": ["error"],
"no-fallthrough": ["error"],
"no-func-assign": ["error"],
"no-import-assign": ["error"],
"no-inner-declarations": ["error"],
"no-invalid-regexp": ["error"],
"no-irregular-whitespace": ["error"],
"no-loss-of-precision": ["error"],
"no-misleading-character-class": ["error"],
"no-new-symbol": ["error"],
"no-obj-calls": ["error"],
"no-magic-numbers": ["warn"],
"no-prototype-builtins": ["error"],
"no-self-assign": ["error"],
"no-self-compare": ["error"],
"no-setter-return": ["error"],
"no-this-before-super": ["error"],
"no-unreachable": ["error"],
"no-unreachable-loop": ["error"],
"no-unsafe-finally": ["error"],
"no-unsafe-negation": ["error"],
"no-unsafe-optional-chaining": ["error"],
"no-use-before-define": ["warn"],
"use-isnan": ["error"],
"array-bracket-newline": ["error", "consistent"],
"array-element-newline": ["error", "consistent"],
"arrow-spacing": ["error", {
before: true,
after: true,
}],
"block-spacing": ["error", "always"],
"dot-location": ["error", "property"],
"eol-last": ["error"],
"func-call-spacing": ["error"],
"function-call-argument-newline": ["error", "consistent"],
"jsx-quotes": ["error"],
"key-spacing": ["error"],
"keyword-spacing": ["error"],
"line-comment-position": ["error"],
"linebreak-style": ["error"],
"max-statements-per-line": ["error"],
"new-parens": ["error"],
"no-mixed-spaces-and-tabs": ["error"],
"no-multi-spaces": ["error"],
"no-multiple-empty-lines": ["error"],
"no-trailing-spaces": ["error"],
"no-whitespace-before-property": ["error"],
"object-curly-newline": ["error"],
"object-curly-spacing": ["error", "always"],
"operator-linebreak": ["error"],
"padded-blocks": ["error", "never"],
"padding-line-between-statements": ["error"],
"rest-spread-spacing": ["error"],
semi: ["error", "never"],
"semi-spacing": ["error"],
"semi-style": ["error"],
"space-before-blocks": ["error"],
"space-infix-ops": ["error"],
"space-unary-ops": ["error"],
"switch-colon-spacing": ["error"],
"template-curly-spacing": ["error"],
"template-tag-spacing": ["error", "always"],
"@atlaskit/design-system/ensure-design-token-usage": ["error", {
domains: ["color"],
shouldEnforceFallbacks: false,
}],
"@atlaskit/design-system/icon-label": ["error"],
"@atlaskit/design-system/no-banned-imports": ["error"],
"@atlaskit/design-system/no-deprecated-apis": ["error"],
"@atlaskit/design-system/no-deprecated-design-token-usage": ["error"],
"@atlaskit/design-system/no-deprecated-imports": ["error"],
"@atlaskit/design-system/no-margin": ["error"],
"@atlaskit/design-system/no-unsafe-design-token-usage": ["error"],
"@atlaskit/design-system/use-visually-hidden": ["error"],
"@atlaskit/ui-styling-standard/enforce-style-prop": ["warn"],
"@atlaskit/ui-styling-standard/no-classname-prop": ["warn"],
"@atlaskit/ui-styling-standard/no-global-styles": ["warn"],
"@atlaskit/ui-styling-standard/no-unsafe-values": ["warn"],
"@atlaskit/ui-styling-standard/no-imported-style-values": ["warn"],
"@atlaskit/design-system/consistent-css-prop-usage": ["warn"],
"@atlaskit/design-system/use-primitives": ["warn"],
"@atlaskit/design-system/no-unsupported-drag-and-drop-libraries": ["warn"],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"react/no-unstable-nested-components": "error",
"react/react-in-jsx-scope": "off",
"react/no-children-prop": "warn",
"react/display-name": "warn",
"react/prop-types": "warn",
},
}]
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@atlaskit/eslint-plugin-design-system": "^10.12.1",
"@atlaskit/eslint-plugin-ui-styling-standard": "^0.18.4",
"@atlaskit/stylelint-design-system": "^2.1.4",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"@compiled/eslint-plugin": "^0.13.9",
"typescript": "^4.9.5",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-unused-imports": "^4.0.1",