.eslintrc.cjs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. module.exports = {
  2. env: {
  3. browser: true,
  4. es6: true,
  5. node: true,
  6. },
  7. ignorePatterns: [
  8. "*.min.*",
  9. "*.user.js",
  10. "*.map",
  11. "dist/**",
  12. ],
  13. extends: [
  14. "eslint:recommended",
  15. "plugin:@typescript-eslint/recommended",
  16. "plugin:react/recommended",
  17. "plugin:react/jsx-runtime",
  18. "plugin:react-hooks/recommended",
  19. ],
  20. globals: {
  21. Atomics: "readonly",
  22. SharedArrayBuffer: "readonly",
  23. GM: "readonly",
  24. unsafeWindow: "writable",
  25. },
  26. parser: "@typescript-eslint/parser",
  27. parserOptions: {
  28. ecmaVersion: "latest",
  29. ecmaFeatures: {
  30. jsx: true,
  31. },
  32. sourceType: "module",
  33. },
  34. plugins: [
  35. "@typescript-eslint",
  36. "react",
  37. "react-hooks",
  38. ],
  39. settings: {
  40. react: {
  41. version: "detect",
  42. },
  43. },
  44. rules: {
  45. "no-unreachable": "off",
  46. "quotes": [ "error", "double" ],
  47. "semi": [ "error", "always" ],
  48. "eol-last": [ "error", "always" ],
  49. "no-async-promise-executor": "off",
  50. "no-cond-assign": "off",
  51. "indent": ["error", 2, { "ignoredNodes": ["VariableDeclaration[declarations.length=0]"] }],
  52. "@typescript-eslint/no-non-null-assertion": "off",
  53. "@typescript-eslint/no-unused-vars": ["warn", { "ignoreRestSiblings": true, "argsIgnorePattern": "^_" }],
  54. "@typescript-eslint/ban-ts-comment": "off",
  55. "@typescript-eslint/ban-types": ["error", {
  56. types: {
  57. "{}": false,
  58. },
  59. extendDefaults: true,
  60. }],
  61. "@typescript-eslint/no-explicit-any": "off",
  62. "comma-dangle": ["error", "only-multiline"],
  63. "no-misleading-character-class": "off",
  64. "react-hooks/rules-of-hooks": "error",
  65. "react-hooks/exhaustive-deps": "error",
  66. "react/react-in-jsx-scope": "off",
  67. "react/prop-types": "off",
  68. },
  69. overrides: [
  70. {
  71. files: ["**.js", "**.mjs", "**.cjs"],
  72. rules: {
  73. "@typescript-eslint/no-var-requires": "off",
  74. "quotes": [ "error", "double" ],
  75. "semi": [ "error", "always" ],
  76. "eol-last": [ "error", "always" ],
  77. "no-async-promise-executor": "off",
  78. "indent": ["error", 2, { "ignoredNodes": ["VariableDeclaration[declarations.length=0]"] }],
  79. "comma-dangle": ["error", "only-multiline"],
  80. },
  81. },
  82. ],
  83. };