Atlassian eslint plugins fail with eslint 9.x

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! :frowning:

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",
2 Likes

And the latest eslint-plugin-design-system release throws an error with eslint 8.x

Error: Failed to load plugin ‘@atlaskit/design-system’ declared in ‘.eslintrc’: Cannot find module ‘…/…/src/migration-map’

1 Like

eslint 8 reached EOL…

1 Like

@ibuchanan could you advise on that one?

@pch Apologies for the delay in responding. I’ve been trying to understand our internal timelines for migrating to ESLint v9 and give you a sufficient response. Currently, it’s not roadmapped for this quarter, but our most recent plugins have support for flat eslint config, so we’re working in the area to speed up our devloops. I expect our monorepo to bump this version in early 2025 which would mean these packages would be bumped to roll that out.

As you highlighted, the ‎‎Develop - Get started - Atlassian Design System page is incorrect (I’ll update it soon). For context, we currently use ESLint v8 in our monorepo, and that’s what drives our plugin support.

I will also note that the team suggested @eslint/compat might allow you to use these plugins in an ESLint v9 setup, but we have not tested this.

And the latest eslint-plugin-design-system release throws an error with eslint 8.x

I believe that error had already been fixed as I can no longer replicate it, but in trying, I notice the latest versions throw a different error introduced in @atlaskit/eslint-plugin-ui-styling-standard@0.21.0 and @atlaskit/eslint-plugin-design-system@10.23.0. I’m hoping to get this fixed soon.

For now I can confirm it should work with these versions, tested via https://codesandbox.io/p/devbox/lr3j5k

  • @atlaskit/eslint-plugin-ui-styling-standard@0.20.1
  • @atlaskit/eslint-plugin-design-system@10.21.1

Yes that has been fixed.

We’ll try the @eslint/compat and let you know.

1 Like