#Eslint problems

7 messages · Page 1 of 1 (latest)

steel wyvern

hey 👋 How can I easily change eslint rules from discordjs.guide - https://discordjs.guide/preparations/setting-up-a-linter.html#setting-up-eslint-rules to work on eslint 9.0.0 - https://eslint.org/docs/latest/use/migrate-to-9.0.0?

Error: Invalid Options:
- Unknown options: resolvePluginsRelativeTo, rulePaths, useEslintrc, extensions, ignorePath
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.
- 'ignorePath' has been removed.
- 'rulePaths' has been removed. Please define your rules using plugins.

Error: Invalid Options:
- Unknown options: resolvePluginsRelativeTo, rulePaths, useEslintrc, extensions, ignorePath
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.
- 'ignorePath' has been removed.
- 'rulePaths' has been removed. Please define your rules using plugins.
Process finished with exit code -1
Oops! Something went wrong! :(

ESLint: 9.0.0

Error: Could not find config file.

error Command failed with exit code 2.
small pivotBOT
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
steel wyvern

I use a config file .eslintrc.json - same as in discordjs.guide

{
  "extends": "eslint:recommended",
  "env": {
    "node": true,
    "es6": true
  },
  "parserOptions": {
    "ecmaVersion": "latest"
  },
  "rules": {
    "arrow-spacing": ["warn", { "before": true, "after": true }],
    "brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
    "comma-dangle": ["error", "always-multiline"],
    "comma-spacing": "error",
    "comma-style": "error",
    "curly": ["error", "multi-line", "consistent"],
    "dot-location": ["error", "property"],
    "handle-callback-err": "off",
    "indent": ["error", "tab", { "SwitchCase": 1 }],
    "keyword-spacing": "error",
    "max-nested-callbacks": ["error", { "max": 4 }],
    "max-statements-per-line": ["error", { "max": 2 }],
    "no-console": "off",
    "no-empty-function": "error",
    "no-floating-decimal": "error",
    "no-inline-comments": "error",
    "no-lonely-if": "error",
    "no-multi-spaces": "error",
    "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }],
    "no-shadow": ["error", { "allow": ["err", "resolve", "reject"] }],
    "no-trailing-spaces": ["error"],
    "no-var": "error",
    "object-curly-spacing": ["error", "always"],
    "prefer-const": "error",
    "quotes": ["error", "single"],
    "semi": ["error", "always"],
    "space-before-blocks": "error",
    "space-before-function-paren": ["error", {
      "anonymous": "never",
      "named": "never",
      "asyncArrow": "always"
    }],
    "space-in-parens": "error",
    "space-infix-ops": "error",
    "space-unary-ops": "error",
    "spaced-comment": "error",
    "yoda": "error"
  }
}

unfortunately it doesn't work in version 9.0.0

silver wind

You literally linked the post of eslint themselves telling you how to upgrade to the new default format. Read it

steel wyvern
silver wind

You are free to open a PR to the guide repository. Or open an issue as feature request on it