mirror of
https://github.com/axllent/mailpit.git
synced 2025-09-16 09:26:37 +02:00
Chore: Update eslint config, remove neostandard
This commit is contained in:
@@ -1,34 +1,76 @@
|
||||
import eslintConfigPrettier from "eslint-config-prettier/flat";
|
||||
import neostandard, { resolveIgnoresFromGitignore } from "neostandard";
|
||||
import globals from "globals";
|
||||
import { includeIgnoreFile } from "@eslint/compat";
|
||||
import js from "@eslint/js";
|
||||
import vue from "eslint-plugin-vue";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const gitignorePath = fileURLToPath(new URL(".gitignore", import.meta.url));
|
||||
|
||||
export default [
|
||||
/* Baseline JS rules, provided by Neostandard */
|
||||
...neostandard({
|
||||
/* Allows references to browser APIs like `document` */
|
||||
env: ["browser"],
|
||||
/* Use .gitignore to prevent linting of irrelevant files */
|
||||
includeIgnoreFile(gitignorePath, ".gitignore"),
|
||||
|
||||
/* We rely on .gitignore to avoid running against dist / dependency files */
|
||||
ignores: resolveIgnoresFromGitignore(),
|
||||
|
||||
/* Disables a range of style-related rules, as we use Prettier for that */
|
||||
noStyle: true,
|
||||
|
||||
/* Ensures we only lint JS and Vue files */
|
||||
/* ESLint's recommended rules */
|
||||
{
|
||||
files: ["**/*.js", "**/*.vue"],
|
||||
}),
|
||||
languageOptions: { globals: { ...globals.browser, ...globals.node } },
|
||||
rules: js.configs.recommended.rules,
|
||||
},
|
||||
|
||||
/* Vue-specific rules */
|
||||
...vue.configs["flat/recommended"],
|
||||
|
||||
/* Prettier is responsible for formatting, so this disables any conflicting rules */
|
||||
/* Prettier is responsible for formatting, so we disable conflicting rules */
|
||||
eslintConfigPrettier,
|
||||
|
||||
/* Our custom rules */
|
||||
{
|
||||
rules: {
|
||||
/* We prefer arrow functions for tidiness and consistency */
|
||||
/* Always use arrow functions for tidiness and consistency */
|
||||
"prefer-arrow-callback": "error",
|
||||
|
||||
/* Always use camelCase for variable names */
|
||||
camelcase: [
|
||||
"error",
|
||||
{
|
||||
ignoreDestructuring: false,
|
||||
ignoreGlobals: true,
|
||||
ignoreImports: false,
|
||||
properties: "never",
|
||||
},
|
||||
],
|
||||
|
||||
/* The default case in switch statements must always be last */
|
||||
"default-case-last": "error",
|
||||
|
||||
/* Always use dot notation where possible (e.g. `obj.val` over `obj['val']`) */
|
||||
"dot-notation": "error",
|
||||
|
||||
/* Always use `===` and `!==` for comparisons unless unambiguous */
|
||||
eqeqeq: ["error", "smart"],
|
||||
|
||||
/* Never use `eval()` as it violates our CSP and can lead to security issues */
|
||||
"no-eval": "error",
|
||||
"no-implied-eval": "error",
|
||||
|
||||
/* Prevents accidental use of template literals in plain strings, e.g. "my ${var}" */
|
||||
"no-template-curly-in-string": "error",
|
||||
|
||||
/* Avoid unnecessary ternary operators */
|
||||
"no-unneeded-ternary": "error",
|
||||
|
||||
/* Avoid unused expressions that have no purpose */
|
||||
"no-unused-expressions": "error",
|
||||
|
||||
/* Always use `const` or `let` to make scope behaviour clear */
|
||||
"no-var": "error",
|
||||
|
||||
/* Always use shorthand syntax for objects where possible, e.g. { a, b() { } } */
|
||||
"object-shorthand": "error",
|
||||
|
||||
/* Always use `const` for variables that are never reassigned */
|
||||
"prefer-const": "error",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
3666
package-lock.json
generated
3666
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@
|
||||
"vue-router": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.3.1",
|
||||
"@popperjs/core": "^2.11.5",
|
||||
"@types/bootstrap": "^5.2.7",
|
||||
"@types/tinycon": "^0.6.3",
|
||||
@@ -40,10 +41,9 @@
|
||||
"eslint": "^9.29.0",
|
||||
"eslint-config-prettier": "^10.1.5",
|
||||
"eslint-plugin-vue": "^10.2.0",
|
||||
"neostandard": "^0.12.1",
|
||||
"prettier": "^3.5.3"
|
||||
},
|
||||
"prettier":{
|
||||
"prettier": {
|
||||
"tabWidth": 4,
|
||||
"useTabs": true,
|
||||
"printWidth": 120
|
||||
|
Reference in New Issue
Block a user