Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] 🛠️ ESLint: extends plugin:@typescript-eslint/recommended config #2967

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 12 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
module.exports = {
root: true,
reportUnusedDisableDirectives: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
},
settings: {
react: {
Expand All @@ -29,6 +27,7 @@ module.exports = {
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:react/recommended',
Expand Down Expand Up @@ -72,7 +71,6 @@ module.exports = {
'no-case-declarations': 0,
'no-div-regex': 1,
'no-else-return': ['error', { allowElseIf: false }],
'no-empty-function': 0,
'no-eq-null': 0,
'no-eval': 1,
'no-extend-native': 1,
Expand Down Expand Up @@ -110,12 +108,9 @@ module.exports = {
'@typescript-eslint/prefer-optional-chain': 'error',
'no-warning-comments': 0,
radix: 'error',
'@typescript-eslint/prefer-as-const': 'error',
'require-await': 0,
// 'require-await': 1,
'vars-on-top': 0,
yoda: 1,
'@typescript-eslint/no-inferrable-types': 'error',

// Strict Mode (http://eslint.org/docs/rules/#strict-mode)
strict: 0,
Expand All @@ -130,7 +125,6 @@ module.exports = {
'no-undef-init': 0,
'no-undefined': 0,

'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
Expand Down Expand Up @@ -176,7 +170,6 @@ module.exports = {
'newline-after-var': 0,
'newline-before-return': 0,
'newline-per-chained-call': 0,
'no-array-constructor': 1,
'no-bitwise': 1,
'no-continue': 0,
'no-inline-comments': 0,
Expand Down Expand Up @@ -209,13 +202,9 @@ module.exports = {
'no-useless-computed-key': 1,
'no-useless-constructor': 0,
'no-useless-rename': 1,
'no-var': 'error',
'object-shorthand': 1,
'prefer-arrow-callback': [0, { allowNamedFunctions: true }], // prettier --list-different
'prefer-const': 1,
'prefer-numeric-literals': 0,
'prefer-rest-params': 0,
'prefer-spread': 1,
'prefer-template': 0,
'sort-imports': 0,
'symbol-description': 1,
Expand Down Expand Up @@ -270,9 +259,19 @@ module.exports = {
'sonarjs/no-duplicated-branches': 'error',
'unicorn/prefer-node-protocol': 'error',
'import/no-unresolved': ['error', { ignore: ['^node:'] }],

// TODO: Fix all errors for the following rules included in recommended config
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/triple-slash-reference': 'off',
'@typescript-eslint/no-namespace': 'off',
},

plugins: ['@typescript-eslint', 'promise', 'sonarjs', 'unicorn'],
plugins: ['promise', 'sonarjs', 'unicorn'],

overrides: [
// Cypress plugin, global, etc., only for cypress directory
Expand Down Expand Up @@ -304,14 +303,6 @@ module.exports = {
'no-console': 'off',
},
},
{
// TODO: Remove this overrides after extending `plugin:@typescript-eslint/recommended` config
files: ['*.ts', '*.tsx'],
rules: {
'no-redeclare': 'off', // ts(2451)
'no-undef': 'off', // ts(2304)
},
},
{
// Disable rules for examples folder
files: ['examples/**'],
Expand Down
1 change: 1 addition & 0 deletions packages/codemirror-graphql/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare module 'codemirror' {
hint?: ShowHintOptions['hint'];
}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface CodeMirrorHintMap {}

const hint: CodeMirrorHintMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ function getSuggestionsForImplements(
return;
}
const type = schema.getType(state.name);
const interfaceConfig = typeInfo.interfaceDef?.toConfig()!;
const interfaceConfig = typeInfo.interfaceDef?.toConfig();
typeInfo.interfaceDef = new GraphQLInterfaceType({
...interfaceConfig,
interfaces: [
Expand All @@ -677,7 +677,7 @@ function getSuggestionsForImplements(
return;
}
const type = schema.getType(state.name);
const objectTypeConfig = typeInfo.objectTypeDef?.toConfig()!;
const objectTypeConfig = typeInfo.objectTypeDef?.toConfig();
typeInfo.objectTypeDef = new GraphQLObjectType({
...objectTypeConfig,
interfaces: [
Expand Down