-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This upgrades to the latest version of ESLint. With this upgrade, the format of the config file change to a `eslint.config.mjs` file. A tool was used by ESLint to convert over the existing .eslintrc.js file. More information on the conversion can be found at https://eslint.org/docs/latest/use/configure/migration-guide. After this upgrade of ESLint, ESLint was ran and tested by making purposeful changes to ensure that errors were caught. This worked successfully, and also found an actual error that was fixed.
- Loading branch information
Showing
6 changed files
with
258 additions
and
191 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import globals from "globals"; | ||
import typescriptEslint from "@typescript-eslint/eslint-plugin"; | ||
import tsParser from "@typescript-eslint/parser"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}); | ||
|
||
export default [{ | ||
ignores: [ | ||
"js/src/lib", | ||
"**/node_modules", | ||
"wwwroot/js/**/*.min.js", | ||
"input/assets/js/*.min.js", | ||
"Scripts/*.min.js", | ||
], | ||
}, ...compat.extends("standard"), { | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
Prism: "readonly", | ||
bootstrap: "readonly", | ||
}, | ||
|
||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
}, | ||
}, ...compat.extends( | ||
"standard", | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
).map(config => ({ | ||
...config, | ||
files: ["js/src/ts/**/*.ts", "playwright/**/*.ts", "build/**/*.ts"], | ||
})), { | ||
files: ["js/src/ts/**/*.ts", "playwright/**/*.ts", "build/**/*.ts"], | ||
|
||
plugins: { | ||
"@typescript-eslint": typescriptEslint, | ||
}, | ||
|
||
languageOptions: { | ||
parser: tsParser, | ||
ecmaVersion: 5, | ||
sourceType: "script", | ||
|
||
parserOptions: { | ||
project: "tsconfig.json", | ||
}, | ||
}, | ||
}, ...compat.extends("plugin:playwright/recommended").map(config => ({ | ||
...config, | ||
files: ["playwright/**/*.ts"], | ||
})), { | ||
files: ["playwright/**/*.ts"], | ||
|
||
languageOptions: { | ||
ecmaVersion: 5, | ||
sourceType: "script", | ||
|
||
parserOptions: { | ||
project: "playwright/tsconfig.json", | ||
}, | ||
}, | ||
|
||
rules: { | ||
"playwright/no-conditional-in-test": 0, | ||
"playwright/expect-expect": 0, | ||
}, | ||
}, { | ||
files: [ | ||
"**/eslint.config.mjs", | ||
"**/postcss.config.js", | ||
"js/**/**/*.*", | ||
"getting-started/*.js", | ||
"playwright/**/*.ts", | ||
"wwwroot/js/src/**/*.js", | ||
"build/**/*.*", | ||
], | ||
|
||
rules: { | ||
semi: ["error", "always"], | ||
quotes: ["error", "single"], | ||
|
||
indent: ["error", 4, { | ||
SwitchCase: 1, | ||
}], | ||
|
||
"no-var": "error", | ||
"one-var": ["error", "never"], | ||
"one-var-declaration-per-line": ["error", "always"], | ||
|
||
"no-unused-vars": ["error", { | ||
varsIgnorePattern: "Alert|Button|Carousel|Collapse|Dropdown|Modal|Offcanvas|Tab", | ||
}], | ||
|
||
"prefer-template": "error", | ||
"prefer-arrow-callback": ["error"], | ||
"func-style": ["error", "expression"], | ||
"arrow-parens": ["error", "as-needed"], | ||
"object-shorthand": ["error", "consistent-as-needed"], | ||
eqeqeq: 0, | ||
}, | ||
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.