2024-06-19 03:27:40 +03:00
|
|
|
// @ts-check
|
|
|
|
|
2024-09-17 23:13:21 +03:00
|
|
|
import tseslint from "typescript-eslint";
|
2024-06-19 03:27:40 +03:00
|
|
|
import notice from "eslint-plugin-notice";
|
2024-09-17 23:13:21 +03:00
|
|
|
import jsdoc from "eslint-plugin-jsdoc";
|
2024-06-28 20:48:34 +03:00
|
|
|
import deprecationPlugin from "eslint-plugin-deprecation";
|
|
|
|
import { fixupPluginRules } from "@eslint/compat";
|
2024-09-17 23:13:21 +03:00
|
|
|
import reactRecommended from "eslint-plugin-react/configs/recommended.js";
|
2024-07-09 19:43:03 +03:00
|
|
|
import react from "eslint-plugin-react";
|
2024-09-17 23:13:21 +03:00
|
|
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
|
|
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
2024-06-19 03:27:40 +03:00
|
|
|
|
|
|
|
export default [
|
|
|
|
{
|
2024-09-17 23:13:21 +03:00
|
|
|
files: ["**/*.ts", "**/*.tsx"],
|
|
|
|
ignores: [
|
|
|
|
"src/prompts/**/*.ts",
|
|
|
|
"**/*.d.ts",
|
|
|
|
"src/reactviews/pages/ExecutionPlan/**/*",
|
|
|
|
], // Ignore prompts files as they are copied from other repos
|
2024-06-19 03:27:40 +03:00
|
|
|
languageOptions: {
|
2024-09-17 23:13:21 +03:00
|
|
|
...reactRecommended.languageOptions,
|
|
|
|
ecmaVersion: "latest",
|
|
|
|
sourceType: "module",
|
2024-06-28 20:48:34 +03:00
|
|
|
parser: tseslint.parser,
|
|
|
|
parserOptions: {
|
2024-07-09 19:43:03 +03:00
|
|
|
project: ["./tsconfig.json", "./tsconfig.react.json"],
|
2024-09-17 23:13:21 +03:00
|
|
|
ecmaFeatures: {
|
|
|
|
jsx: true,
|
|
|
|
},
|
2024-06-28 20:48:34 +03:00
|
|
|
},
|
2024-06-19 03:27:40 +03:00
|
|
|
},
|
|
|
|
plugins: {
|
|
|
|
notice,
|
2024-06-28 20:48:34 +03:00
|
|
|
jsdoc,
|
2024-09-17 23:13:21 +03:00
|
|
|
["@typescript-eslint"]: tseslint.plugin,
|
2024-06-28 20:48:34 +03:00
|
|
|
// @ts-ignore
|
|
|
|
["deprecation"]: fixupPluginRules(deprecationPlugin),
|
2024-07-09 19:43:03 +03:00
|
|
|
react,
|
2024-09-17 23:13:21 +03:00
|
|
|
"jsx-a11y": jsxA11y,
|
|
|
|
...eslintPluginPrettierRecommended.plugins
|
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
react: {
|
|
|
|
version: "detect",
|
|
|
|
},
|
2024-06-19 03:27:40 +03:00
|
|
|
},
|
|
|
|
rules: {
|
2024-09-17 23:13:21 +03:00
|
|
|
...eslintPluginPrettierRecommended.rules,
|
|
|
|
"notice/notice": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
template:
|
|
|
|
"/*---------------------------------------------------------------------------------------------" +
|
|
|
|
"\n" +
|
|
|
|
" * Copyright (c) Microsoft Corporation. All rights reserved." +
|
|
|
|
"\n" +
|
|
|
|
" * Licensed under the MIT License. See License.txt in the project root for license information." +
|
|
|
|
"\n" +
|
|
|
|
" *--------------------------------------------------------------------------------------------*/" +
|
|
|
|
"\n" +
|
|
|
|
"\n",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"no-undef": "off",
|
|
|
|
"no-unused-vars": "off",
|
|
|
|
"constructor-super": "warn",
|
|
|
|
curly: "off",
|
|
|
|
eqeqeq: "warn",
|
|
|
|
"no-buffer-constructor": "warn",
|
|
|
|
"no-caller": "warn",
|
|
|
|
"no-debugger": "warn",
|
|
|
|
"no-duplicate-case": "warn",
|
|
|
|
"no-duplicate-imports": "error",
|
|
|
|
"no-eval": "warn",
|
|
|
|
"no-async-promise-executor": "off",
|
|
|
|
"no-extra-semi": "warn",
|
|
|
|
"no-new-wrappers": "warn",
|
|
|
|
"no-redeclare": "off",
|
|
|
|
"no-sparse-arrays": "warn",
|
|
|
|
"no-throw-literal": "off",
|
|
|
|
"no-unsafe-finally": "warn",
|
|
|
|
"no-unused-labels": "warn",
|
|
|
|
"no-restricted-globals": [
|
|
|
|
"warn",
|
|
|
|
"name",
|
|
|
|
"length",
|
|
|
|
"event",
|
|
|
|
"closed",
|
|
|
|
"external",
|
|
|
|
"status",
|
|
|
|
"origin",
|
|
|
|
"orientation",
|
|
|
|
"context",
|
|
|
|
], // non-complete list of globals that are easy to access unintentionally
|
|
|
|
"no-var": "off",
|
|
|
|
"jsdoc/no-types": "warn",
|
|
|
|
"no-restricted-syntax": ["warn", "Literal[raw='null']"],
|
|
|
|
"@typescript-eslint/no-explicit-any": "warn",
|
|
|
|
// Not really that useful, there are valid reasons to have empty functions
|
|
|
|
"@typescript-eslint/no-empty-function": "off",
|
|
|
|
"@typescript-eslint/no-inferrable-types": [
|
|
|
|
"warn",
|
|
|
|
{
|
|
|
|
ignoreParameters: true,
|
|
|
|
ignoreProperties: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"@typescript-eslint/no-unused-vars": [
|
|
|
|
"warn",
|
|
|
|
{
|
|
|
|
argsIgnorePattern: "^_",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"deprecation/deprecation": "warn",
|
|
|
|
"@typescript-eslint/no-floating-promises": [
|
|
|
|
"warn",
|
|
|
|
{
|
|
|
|
ignoreVoid: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"@typescript-eslint/naming-convention": [
|
|
|
|
"warn",
|
|
|
|
{
|
|
|
|
selector: "property",
|
|
|
|
modifiers: ["private"],
|
|
|
|
format: ["camelCase"],
|
|
|
|
leadingUnderscore: "require",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"@typescript-eslint/semi": "warn",
|
|
|
|
//...jsxA11y.flatConfigs.recommended.rules,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|