website/eslint.config.mjs

60 lines
No EOL
2.3 KiB
JavaScript

import pluginJs from "@eslint/js";
import stylisticJs from "@stylistic/eslint-plugin-js";
import globals from "globals";
export default [
{files: ["**/*.{js,mjs,cjs,ts}"],},
{languageOptions: { globals: globals.node }},
pluginJs.configs.recommended,
{
ignores: ["dist/*", "**/jquery.js"]
},
{
plugins: {
"@stylistic/js": stylisticJs,
},
rules: {
"yoda": "error",
"eqeqeq": ["error", "always", { "null": "ignore" }],
"prefer-destructuring": ["error", {
"VariableDeclarator": { "array": false, "object": true },
"AssignmentExpression": { "array": false, "object": false }
}],
"operator-assignment": ["error", "always"],
"no-useless-computed-key": "error",
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
"no-invalid-regexp": "error",
"no-constant-condition": ["error", { "checkLoops": false }],
"no-duplicate-imports": "error",
"dot-notation": "error",
"no-fallthrough": "error",
"for-direction": "error",
"no-async-promise-executor": "error",
"no-cond-assign": "error",
"no-dupe-else-if": "error",
"no-duplicate-case": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-prototype-builtins": "error",
"no-regex-spaces": "error",
"no-shadow-restricted-names": "error",
"no-unexpected-multiline": "error",
"no-unsafe-optional-chaining": "error",
"no-useless-backreference": "error",
"use-isnan": "error",
"prefer-const": "error",
"prefer-spread": "error",
"semi": [2, "always"],
"@stylistic/js/indent": ["error", 4],
"@stylistic/js/quotes": [2, "double", { "avoidEscape": true }]
}
},
{
files: ["public/**/*.js"],
rules: {
"no-undef": "off", // due to being separate files eslint goes insane
"@typescript-eslint/no-unused-vars": ["off"] // noone cares lol
}
}
];