From 09a1226758da9424c440a8fe5e62bbe0a01a3bdf Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Mon, 15 May 2023 21:11:30 +0300 Subject: [PATCH] fix eslint core rules --- .eslintrc.yml | 7 ------- src/editor/custom.d.ts | 2 +- src/editor/index.tsx | 8 +++++--- src/fake.ts | 2 +- src/index.ts | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index a024a72e..636be221 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -19,10 +19,6 @@ rules: 'import/no-extraneous-dependencies': [error, { devDependencies: ['**/*.config.{js,ts}', 'tests/**'] }] - # FIXME: remove below rules - 'no-var': off - 'prefer-const': off - overrides: - files: '**/*.js' env: @@ -45,9 +41,6 @@ overrides: [error, index-signature] # FIXME: remove below rules - 'no-empty': off - 'no-var': off - 'prefer-const': off 'react/jsx-no-target-blank': off 'import/no-duplicates': off 'import/no-extraneous-dependencies': off diff --git a/src/editor/custom.d.ts b/src/editor/custom.d.ts index d671f3d7..de8f2c7d 100644 --- a/src/editor/custom.d.ts +++ b/src/editor/custom.d.ts @@ -1,4 +1,4 @@ declare module '*.css' { - var content: any; + const content: any; export = content; } diff --git a/src/editor/index.tsx b/src/editor/index.tsx index 61f3574f..669bb93b 100644 --- a/src/editor/index.tsx +++ b/src/editor/index.tsx @@ -126,7 +126,7 @@ class FakeEditor extends React.Component { } saveUserSDL = () => { - let { value, hasUnsavedChanges } = this.state; + const { value, hasUnsavedChanges } = this.state; if (!hasUnsavedChanges) return; if (!this.updateSDL(value)) return; @@ -161,7 +161,9 @@ class FakeEditor extends React.Component { let unsavedSchema = null as GraphQLSchema | null; try { unsavedSchema = this.buildSchema(val, { skipValidation: true }); - } catch (_) {} + } catch (_) { + // FIXME + } this.setState((prevState) => ({ ...prevState, @@ -172,7 +174,7 @@ class FakeEditor extends React.Component { }; render() { - let { value, activeTab, schema, hasUnsavedChanges, unsavedSchema } = this.state; + const { value, activeTab, schema, hasUnsavedChanges, unsavedSchema } = this.state; if (value == null || schema == null) { return
Loading...
; } diff --git a/src/fake.ts b/src/fake.ts index 11980406..11c533ae 100644 --- a/src/fake.ts +++ b/src/fake.ts @@ -196,7 +196,7 @@ const fakeFunctions = { }; Object.keys(fakeFunctions).forEach((key) => { - var value = fakeFunctions[key]; + const value = fakeFunctions[key]; if (typeof fakeFunctions[key] === 'function') fakeFunctions[key] = { args: [], func: value }; }); diff --git a/src/index.ts b/src/index.ts index 0c16024d..b296849a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -193,7 +193,7 @@ function prettyPrintValidationErrors(validationErrors: ValidationErrors) { ); for (const error of subErrors) { - let [message, ...otherLines] = error.toString().split('\n'); + const [message, ...otherLines] = error.toString().split('\n'); log([chalk.yellow(message), ...otherLines].join('\n') + '\n\n'); } }