this is really a js question but I figured I would...
# suitescript
s
this is really a js question but I figured I would ask here this is my old .eslintrc.js but now I need to convert and I'm a little confused about this
Copy code
module.exports = {
  env: {
    browser: true,
    commonjs: true,
    es2021: true,
    node: true,
  },
  extends: [
    "plugin:suitescript/all",
    "eslint:recommended",
    "plugin:jest/recommended",
  ],

  plugins: ["suitescript", "jest"],
  overrides: [
    {
      env: {
        amd: true,
        node: true,
        jest: true,
      },

      files: ["src/**/*.js"],
      parserOptions: {
        sourceType: "module",
      },
    },
  ],
  parserOptions: {
    ecmaVersion: "latest",
  },
  rules: {
    "suitescript/script-type": "error",
    "suitescript/no-log-module": "error",
  },
};
m
I haven't tested but fwiw this is what Claude came up with given your existing config and the migration guide https://cloud.typingmind.com/share/8aa3c507-7c02-461f-8f28-0ef85919c45e
Looking a little more into this, eslint have a tool to migrate config https://www.npmjs.com/package/@eslint/migrate-config
s
Yes I used the tool but hey guess what it doesn't work
the tool doesnt work for the .js module
m
The migration tool didn't work for me either, but it was helpful as a starting point. A lot of the plugins don't seem very compatible with the upgrade. So I ended up just recreating the rules found in the plugins that divert from recommended. I have only started upgrading on the SuiteCommerce side since it's helpful in being able to split out rules for different globs. Here is an working linting from a project. You can adjust the rules and ignores for Suitescript packages.
Copy code
import globals from "globals";
import pluginJs from "@eslint/js";

export default [
    pluginJs.configs.recommended
    // ignore toolset scripts, build directories, and node packages
    , {
        ignores: [
            "DeployDistribution/"
            , "gulp/"
            , "LocalDistribution/"
            , "node_modules/"
            , "ns_npm_repository/"
            , "tmp/"
            , "Workspace/Extras/"
            , "gulpfile.js"
        ]
    }
    // default rules eslint-config-google with recommended removed and minor changes
    , {
        rules: {
            "no-cond-assign": "off"
            , "curly": ["error", "multi-line"]
            , "no-multi-spaces": "error"
            , "no-multi-str": "error"
            , "no-unused-vars": ["error", {args: "none"}]
            , "array-bracket-newline": "off"
            , "array-bracket-spacing": ["error", "never"]
            , "array-element-newline": "off"
            , "block-spacing": ["error", "never"]
            , "brace-style": "error"
            , "camelcase": "off"
            , "comma-dangle": ["error", "never"]
            , "comma-spacing": "error"
            , "comma-style": ["error", "first"]
            , "computed-property-spacing": "error"
            , "eol-last": "error"
            , "func-call-spacing": "error"
            , "indent": [
                "error", 4, {"SwitchCase": 1}
            ]
            , "key-spacing": "error"
            , "keyword-spacing": "error"
            , "linebreak-style": ["error", "unix"]
            , "max-len": ["error", {
                code: 180
                , ignoreComments: true
            }]
            , "new-cap": "off"
            , "no-mixed-spaces-and-tabs": "error"
            , "no-multiple-empty-lines": ["error", {max: 2}]
            , "no-new-object": "error"
            , "no-tabs": "error"
            , "no-trailing-spaces": "error"
            , "object-curly-spacing": "error"
            , "one-var": ["error", {
                var: "never"
                , let: "never"
                , const: "never"
            }]
            , "operator-linebreak": ["error", "after"]
            , "padded-blocks": ["error", "never"]
            , "quote-props": ["error", "consistent"]
            , "quotes": ["error", "double", {allowTemplateLiterals: true}]
            , "semi": ["error", "always"]
            , "semi-spacing": "error"
            , "space-before-blocks": "error"
            , "space-before-function-paren": ["error", {
                asyncArrow: "always"
                , anonymous: "never"
                , named: "never"
            }]
            , "spaced-comment": ["error", "always"]
            , "switch-colon-spacing": "error"
            , "arrow-parens": ["error", "always"]
            , "constructor-super": "error"
            , "generator-star-spacing": ["error", "after"]
            , "no-new-symbol": "error"
            , "no-unsafe-finally": "off"
            , "no-this-before-super": "error"
            , "no-var": "error"
            , "prefer-const": ["error", {destructuring: "all"}]
            , "prefer-rest-params": "error"
            , "prefer-spread": "error"
            , "rest-spread-spacing": "error"
            , "yield-star-spacing": ["error", "after"]
        }
    }
    // disable no-var for services
    , {
        files: [
            "Workspace/**/SuiteScript2/*"
        ]
        , rules: {
            "no-var": "off"
        }
    }
    , {
        languageOptions: {
            globals: {
                ...globals.browser
                , ...globals.amd
            }
            , ecmaVersion: "latest"
            , sourceType: "module"
        }
    }
];