cursorless/.eslintrc.json
Andreas Arvidsson 6b87f2f4d0
consistent-type-imports rule (#2619)
related #2618
revives https://github.com/cursorless-dev/cursorless/pull/1832

vscode quick fix import and auto import appears to be doing the right
thing in regards to type only or runtime imports. Imports organize or
imports fix unfortunately do not convert a runtime import to a type
import if it's only used as a type. We probably need to rely on the
linter to do that part for us.

## Checklist

- [/] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [/] I have not broken the cheatsheet

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-08-02 06:34:35 +00:00

120 lines
2.9 KiB
JSON

{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
// We want to enable this in the long run. For now there are a lot of errors that needs to be handled.
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript",
"prettier"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"project": true
},
"plugins": [
"@typescript-eslint",
"unused-imports",
"import",
"unicorn",
"mocha"
],
"rules": {
"import/no-relative-packages": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-assertions": [
"error",
{
"assertionStyle": "as"
}
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": ["objectLiteralProperty"],
"format": ["camelCase"],
"filter": {
"regex": "[.]",
"match": false
}
}
],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"unused-imports/no-unused-imports": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"curly": "error",
"eqeqeq": [
"error",
"always",
{
"null": "never"
}
],
"no-constant-condition": [
"error",
{
"checkLoops": false
}
],
"no-restricted-syntax": [
"error",
"MemberExpression[object.property.name='constructor'][property.name='name']"
],
"no-throw-literal": "error",
"semi": "off",
"unicorn/prefer-module": "error",
"mocha/no-skipped-tests": "error",
"mocha/no-exclusive-tests": "error"
},
"overrides": [
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/naming-convention": [
"error",
{
"selector": ["function"],
"format": ["PascalCase", "camelCase"]
}
]
}
},
{
"files": [
"jest.config.ts",
"docusaurus.config.mts",
"mdx-components.tsx",
"typings/**"
],
"extends": ["plugin:@typescript-eslint/disable-type-checked"]
}
],
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
"project": ["tsconfig.json", "packages/*/tsconfig.json"]
}
}
},
"ignorePatterns": [
"**/generated/**",
"**/out/**",
"**/vendor/**/*.js",
"**/vendor/**/*.ts",
"/data/playground/**"
]
}