2024-12-05 17:39:25 +01:00
|
|
|
import globals from "globals"
|
|
|
|
import babelParser from "@babel/eslint-parser"
|
2024-12-05 19:13:32 +01:00
|
|
|
import svelteParser from "svelte-eslint-parser"
|
2024-12-05 17:39:25 +01:00
|
|
|
import tsParser from "@typescript-eslint/parser"
|
2024-12-05 19:13:32 +01:00
|
|
|
|
|
|
|
import eslintPluginJest from "eslint-plugin-jest"
|
|
|
|
import eslintPluginSvelte from "eslint-plugin-svelte"
|
|
|
|
import eslintPluginLocalRules from "eslint-plugin-local-rules"
|
2024-12-09 12:21:23 +01:00
|
|
|
import eslintPluginVitest from "@vitest/eslint-plugin"
|
2024-12-05 17:39:25 +01:00
|
|
|
|
|
|
|
import eslint from "@eslint/js"
|
|
|
|
import tseslint from "typescript-eslint"
|
|
|
|
|
|
|
|
export default [
|
2024-12-05 19:13:32 +01:00
|
|
|
eslint.configs.recommended,
|
2024-12-05 17:39:25 +01:00
|
|
|
{
|
|
|
|
ignores: [
|
|
|
|
"**/node_modules",
|
|
|
|
"**/dist",
|
|
|
|
"**/public",
|
|
|
|
"**/bundle.js",
|
2024-12-09 12:21:23 +01:00
|
|
|
"**/coverage",
|
2024-12-05 17:39:25 +01:00
|
|
|
"packages/server/builder",
|
|
|
|
"packages/server/client",
|
|
|
|
"packages/builder/.routify",
|
|
|
|
"packages/sdk/sdk",
|
|
|
|
"**/*.ivm.bundle.js",
|
|
|
|
"packages/server/build/oldClientVersions/**/**/*",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
plugins: {
|
2024-12-05 19:13:32 +01:00
|
|
|
"local-rules": eslintPluginLocalRules,
|
2024-12-05 17:39:25 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
languageOptions: {
|
|
|
|
globals: {
|
|
|
|
...globals.browser,
|
|
|
|
...globals.jest,
|
|
|
|
...globals.node,
|
2024-12-05 19:13:32 +01:00
|
|
|
GeolocationPositionError: true,
|
2024-12-05 17:39:25 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
parser: babelParser,
|
|
|
|
ecmaVersion: 2019,
|
|
|
|
sourceType: "module",
|
|
|
|
|
|
|
|
parserOptions: {
|
|
|
|
allowImportExportEverywhere: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
rules: {
|
|
|
|
"no-self-assign": "off",
|
2024-12-05 19:13:32 +01:00
|
|
|
"prefer-const": "off",
|
2024-12-05 17:39:25 +01:00
|
|
|
"no-unused-vars": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
varsIgnorePattern: "^_",
|
|
|
|
argsIgnorePattern: "^_",
|
|
|
|
destructuredArrayIgnorePattern: "^_",
|
|
|
|
ignoreRestSiblings: true,
|
2024-12-05 19:13:32 +01:00
|
|
|
caughtErrors: "none",
|
2024-12-05 17:39:25 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2024-12-05 19:13:32 +01:00
|
|
|
...eslintPluginSvelte.configs["flat/recommended"].map(config => {
|
|
|
|
return {
|
|
|
|
...config,
|
|
|
|
files: ["**/*.svelte"],
|
2024-12-05 17:39:25 +01:00
|
|
|
|
2024-12-05 19:13:32 +01:00
|
|
|
languageOptions: {
|
|
|
|
parser: svelteParser,
|
|
|
|
ecmaVersion: 2019,
|
|
|
|
sourceType: "script",
|
2024-12-05 17:39:25 +01:00
|
|
|
|
2024-12-05 19:13:32 +01:00
|
|
|
parserOptions: {
|
|
|
|
parser: "@typescript-eslint/parser",
|
|
|
|
allowImportExportEverywhere: true,
|
|
|
|
},
|
2024-12-05 17:39:25 +01:00
|
|
|
},
|
2024-12-05 19:13:32 +01:00
|
|
|
}
|
|
|
|
}),
|
|
|
|
...tseslint.configs.recommended.map(config => {
|
|
|
|
return {
|
|
|
|
...config,
|
|
|
|
files: ["**/*.ts"],
|
2024-12-05 17:39:25 +01:00
|
|
|
|
2024-12-05 19:13:32 +01:00
|
|
|
languageOptions: {
|
|
|
|
globals: {
|
|
|
|
NodeJS: true,
|
|
|
|
},
|
2024-12-05 17:39:25 +01:00
|
|
|
|
2024-12-05 19:13:32 +01:00
|
|
|
parser: tsParser,
|
2024-12-05 17:39:25 +01:00
|
|
|
},
|
|
|
|
|
2024-12-05 19:13:32 +01:00
|
|
|
rules: {
|
|
|
|
"local-rules/no-barrel-imports": "error",
|
|
|
|
"local-rules/no-budibase-imports": "error",
|
|
|
|
"local-rules/no-console-error": "error",
|
|
|
|
|
2024-12-09 12:21:23 +01:00
|
|
|
// @typscript-eslint/no-unused-vars supersedes no-unused-vars
|
|
|
|
"no-unused-vars": "off",
|
2024-12-05 19:13:32 +01:00
|
|
|
"@typescript-eslint/no-unused-vars": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
varsIgnorePattern: "^_",
|
|
|
|
argsIgnorePattern: "^_",
|
|
|
|
destructuredArrayIgnorePattern: "^_",
|
|
|
|
ignoreRestSiblings: true,
|
|
|
|
caughtErrors: "none",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
2024-12-09 12:21:23 +01:00
|
|
|
// @typescript-eslint/no-redeclare supersedes no-redeclare
|
2024-12-05 19:13:32 +01:00
|
|
|
"no-redeclare": "off",
|
|
|
|
"@typescript-eslint/no-redeclare": "error",
|
2024-12-09 12:21:23 +01:00
|
|
|
|
|
|
|
// @typescript-eslint/no-dupe-class-members supersedes no-dupe-class-members
|
2024-12-05 19:13:32 +01:00
|
|
|
"no-dupe-class-members": "off",
|
2024-12-09 12:21:23 +01:00
|
|
|
"@typescript-eslint/no-dupe-class-members": "error",
|
2024-12-05 19:13:32 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}),
|
2024-12-05 17:39:25 +01:00
|
|
|
{
|
2024-12-09 12:21:23 +01:00
|
|
|
files: ["**/*.spec.ts", "**/*.spec.js"],
|
2024-12-05 17:39:25 +01:00
|
|
|
|
|
|
|
plugins: {
|
2024-12-05 19:13:32 +01:00
|
|
|
jest: eslintPluginJest,
|
2024-12-09 12:21:23 +01:00
|
|
|
vitest: eslintPluginVitest,
|
2024-12-05 17:39:25 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
languageOptions: {
|
|
|
|
globals: {
|
2024-12-05 19:13:32 +01:00
|
|
|
...eslintPluginJest.environments.globals.globals,
|
2024-12-09 12:21:23 +01:00
|
|
|
...eslintPluginVitest.environments.env.globals,
|
2024-12-05 17:39:25 +01:00
|
|
|
NodeJS: true,
|
|
|
|
},
|
|
|
|
|
|
|
|
parser: tsParser,
|
|
|
|
},
|
|
|
|
|
|
|
|
rules: {
|
2024-12-09 12:21:23 +01:00
|
|
|
...eslintPluginVitest.configs.recommended.rules,
|
|
|
|
...eslintPluginJest.configs.recommended.rules,
|
|
|
|
|
2024-12-05 17:39:25 +01:00
|
|
|
"no-console": "warn",
|
2024-12-09 12:21:23 +01:00
|
|
|
|
|
|
|
"vitest/expect-expect": "off",
|
|
|
|
|
2024-12-05 17:39:25 +01:00
|
|
|
"jest/expect-expect": "off",
|
|
|
|
"jest/no-conditional-expect": "off",
|
2024-12-09 12:21:23 +01:00
|
|
|
"jest/no-disabled-tests": "off",
|
|
|
|
"jest/no-standalone-expect": "off",
|
|
|
|
|
|
|
|
"local-rules/no-test-com": "error",
|
|
|
|
"local-rules/email-domain-example-com": "error",
|
2024-12-05 17:39:25 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: [
|
|
|
|
"packages/builder/**/*",
|
|
|
|
"packages/client/**/*",
|
|
|
|
"packages/frontend-core/**/*",
|
|
|
|
],
|
|
|
|
|
|
|
|
rules: {
|
|
|
|
"no-console": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
allow: ["warn", "error", "debug"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|