|
| 1 | +/* |
| 2 | + * SPDX-License-Identifier: GPL-3.0 |
| 3 | + * Vesktop, a desktop app aiming to give you a snappier Discord Experience |
| 4 | + * Copyright (c) 2023 Vendicated and Vencord contributors |
| 5 | + */ |
| 6 | + |
| 7 | +//@ts-check |
| 8 | + |
| 9 | +import stylistic from "@stylistic/eslint-plugin"; |
| 10 | +import pathAlias from "eslint-plugin-path-alias"; |
| 11 | +import header from "eslint-plugin-simple-header"; |
| 12 | +import importSort from "eslint-plugin-simple-import-sort"; |
| 13 | +import unusedImports from "eslint-plugin-unused-imports"; |
| 14 | +import tseslint from "typescript-eslint"; |
| 15 | +import prettier from "eslint-plugin-prettier"; |
| 16 | + |
| 17 | +export default tseslint.config( |
| 18 | + { ignores: ["dist"] }, |
| 19 | + |
| 20 | + { |
| 21 | + files: ["src/**/*.{tsx,ts,mts,mjs,js,jsx}"], |
| 22 | + plugins: { |
| 23 | + header, |
| 24 | + stylistic, |
| 25 | + importSort, |
| 26 | + unusedImports, |
| 27 | + pathAlias, |
| 28 | + prettier |
| 29 | + }, |
| 30 | + settings: { |
| 31 | + "import/resolver": { |
| 32 | + alias: { |
| 33 | + map: [] |
| 34 | + } |
| 35 | + } |
| 36 | + }, |
| 37 | + languageOptions: { |
| 38 | + parser: tseslint.parser, |
| 39 | + parserOptions: { |
| 40 | + project: true, |
| 41 | + tsconfigRootDir: import.meta.dirname |
| 42 | + } |
| 43 | + }, |
| 44 | + rules: { |
| 45 | + "header/header": [ |
| 46 | + "error", |
| 47 | + { |
| 48 | + files: ["scripts/header.txt"] |
| 49 | + } |
| 50 | + ], |
| 51 | + |
| 52 | + // ESLint Rules |
| 53 | + |
| 54 | + yoda: "error", |
| 55 | + eqeqeq: ["error", "always", { null: "ignore" }], |
| 56 | + "prefer-destructuring": [ |
| 57 | + "error", |
| 58 | + { |
| 59 | + VariableDeclarator: { array: false, object: true }, |
| 60 | + AssignmentExpression: { array: false, object: false } |
| 61 | + } |
| 62 | + ], |
| 63 | + "operator-assignment": ["error", "always"], |
| 64 | + "no-useless-computed-key": "error", |
| 65 | + "no-unneeded-ternary": ["error", { defaultAssignment: false }], |
| 66 | + "no-invalid-regexp": "error", |
| 67 | + "no-constant-condition": ["error", { checkLoops: false }], |
| 68 | + "no-duplicate-imports": "error", |
| 69 | + "dot-notation": "error", |
| 70 | + "no-useless-escape": "error", |
| 71 | + "no-fallthrough": "error", |
| 72 | + "for-direction": "error", |
| 73 | + "no-async-promise-executor": "error", |
| 74 | + "no-cond-assign": "error", |
| 75 | + "no-dupe-else-if": "error", |
| 76 | + "no-duplicate-case": "error", |
| 77 | + "no-irregular-whitespace": "error", |
| 78 | + "no-loss-of-precision": "error", |
| 79 | + "no-misleading-character-class": "error", |
| 80 | + "no-prototype-builtins": "error", |
| 81 | + "no-regex-spaces": "error", |
| 82 | + "no-shadow-restricted-names": "error", |
| 83 | + "no-unexpected-multiline": "error", |
| 84 | + "no-unsafe-optional-chaining": "error", |
| 85 | + "no-useless-backreference": "error", |
| 86 | + "use-isnan": "error", |
| 87 | + "prefer-const": "error", |
| 88 | + "prefer-spread": "error", |
| 89 | + |
| 90 | + // Styling Rules |
| 91 | + "stylistic/spaced-comment": ["error", "always", { markers: ["!"] }], |
| 92 | + "stylistic/no-extra-semi": "error", |
| 93 | + |
| 94 | + // Plugin Rules |
| 95 | + "importSort/imports": "error", |
| 96 | + "importSort/exports": "error", |
| 97 | + "unusedImports/no-unused-imports": "error", |
| 98 | + "pathAlias/no-relative": "error", |
| 99 | + "prettier/prettier": "error" |
| 100 | + } |
| 101 | + } |
| 102 | +); |
0 commit comments