From 37e32b60397659217334a639e828993742b8b966 Mon Sep 17 00:00:00 2001 From: shmck Date: Sat, 27 Jun 2020 12:55:10 -0700 Subject: [PATCH 1/2] fix linting issues on src Signed-off-by: shmck --- .eslintrc.js | 3 +- package.json | 26 ++++---- src/actions/saveCommit.ts | 2 +- src/channel/context.ts | 2 +- src/channel/index.ts | 4 +- src/editor/commands.ts | 2 +- web-app/.eslintrc.js | 64 ------------------- web-app/package.json | 26 ++++---- .../containers/Tutorial/components/Hints.tsx | 1 + 9 files changed, 34 insertions(+), 96 deletions(-) delete mode 100644 web-app/.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js index 1475941b..c65aacf3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,9 +1,10 @@ module.exports = { parser: '@typescript-eslint/parser', // Specifies the ESLint parser + plugins: ['prettier'], extends: [ 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier - 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array + 'plugin:prettier/recommended', ], parserOptions: { ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features diff --git a/package.json b/package.json index 5e4d7b03..cac6b1b8 100644 --- a/package.json +++ b/package.json @@ -34,30 +34,30 @@ "watch": "tsc -watch -p ./" }, "dependencies": { - "@sentry/node": "^5.17.0", - "@types/assert": "^1.4.7", - "@types/jest": "^26.0.0", + "@sentry/node": "^5.18.1", + "@types/assert": "^1.5.1", + "@types/jest": "^26.0.3", "@types/jsdom": "^16.2.3", - "@types/node": "^14.0.13", + "@types/node": "^14.0.14", "@types/node-fetch": "^2.5.7", - "@types/semver": "^7.2.0", - "@typescript-eslint/eslint-plugin": "^3.3.0", - "@typescript-eslint/parser": "^3.3.0", + "@types/semver": "^7.3.1", + "@typescript-eslint/eslint-plugin": "^3.4.0", + "@typescript-eslint/parser": "^3.4.0", "chokidar": "^3.4.0", "dotenv": "^8.2.0", - "eslint": "^7.2.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-prettier": "^3.1.4", + "eslint": "^7.3.1", "git-url-parse": "^11.1.2", - "jest": "^26.0.1", + "jest": "^26.1.0", "jsdom": "^16.2.2", "node-fetch": "^2.6.0", - "prettier": "^2.0.5", "semver": "^7.3.2", - "ts-jest": "^26.1.0", + "ts-jest": "^26.1.1", "typescript": "^3.9.5" }, "devDependencies": { + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-prettier": "^3.1.4", + "prettier": "2.0.5", "vscode": "^1.1.37", "vscode-test": "^1.4.0" }, diff --git a/src/actions/saveCommit.ts b/src/actions/saveCommit.ts index 146242e3..74002c5e 100644 --- a/src/actions/saveCommit.ts +++ b/src/actions/saveCommit.ts @@ -1,6 +1,6 @@ import * as git from '../services/git' -async function saveCommit() { +async function saveCommit(): Promise { git.saveCommit('Save progress') } diff --git a/src/channel/context.ts b/src/channel/context.ts index 3e61919c..8965d535 100644 --- a/src/channel/context.ts +++ b/src/channel/context.ts @@ -24,7 +24,7 @@ class Context { const position: CR.Position = this.position.setPositionFromProgress(tutorial, progress) return { progress, position } } - public reset = () => { + public reset = (): void => { this.tutorial.reset() this.progress.reset() this.position.reset() diff --git a/src/channel/index.ts b/src/channel/index.ts index d05a61e7..a29674ff 100644 --- a/src/channel/index.ts +++ b/src/channel/index.ts @@ -42,7 +42,7 @@ class Channel implements Channel { } // receive from webview - public receive = async (action: T.Action) => { + public receive = async (action: T.Action): Promise => { // action may be an object.type or plain string const actionType: string = typeof action === 'string' ? action : action.type // const onError = (error: T.ErrorMessage) => this.send({ type: 'ERROR', payload: { error } }) @@ -325,7 +325,7 @@ class Channel implements Channel { } } // send to webview - public send = async (action: T.Action) => { + public send = async (action: T.Action): Promise => { // Error middleware if (action?.payload?.error?.type) { // load error markdown message diff --git a/src/editor/commands.ts b/src/editor/commands.ts index b3512150..84c175ae 100644 --- a/src/editor/commands.ts +++ b/src/editor/commands.ts @@ -19,7 +19,7 @@ interface CreateCommandProps { workspaceState: vscode.Memento } -export const createCommands = ({ extensionPath, workspaceState }: CreateCommandProps) => { +export const createCommands = ({ extensionPath, workspaceState }: CreateCommandProps): { [key: string]: any } => { // React panel webview let webview: any let currentPosition: T.Position diff --git a/web-app/.eslintrc.js b/web-app/.eslintrc.js deleted file mode 100644 index e18d5f24..00000000 --- a/web-app/.eslintrc.js +++ /dev/null @@ -1,64 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', // Specifies the ESLint parser - extends: [ - 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin - 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier - 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array - ], - parserOptions: { - ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features - sourceType: 'module', // Allows for the use of imports - ecmaFeatures: { - jsx: true, // Allows for the parsing of JSX - useJSXTextNode: true, - }, - }, - rules: { - // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs - // e.g. - 'comma-dangles': 0, - 'global-require': 0, - 'import/no-extraneous-dependencies': 0, - 'import/no-named-as-default': 0, - 'import/prefer-default-export': 0, - 'jsx-a11y/href-no-hash': 0, - quotes: ['error', 'single'], - 'no-tabs': 0, - 'react/jsx-curly-spacing': 0, - 'react/jsx-indent-props': 'off', - 'react/prop-types': 0, - 'react/sort-comp': 0, - 'react/prefer-stateless-function': 0, - semi: ['error', 'never'], - 'object-curly-newline': 0, - 'react/jsx-indent': 'off', - 'class-methods-use-this': 0, - indent: 'off', - 'implicit-arrow-linebreak': 'off', - 'function-paren-newline': 'off', - 'lines-between-class-members': 'off', - 'no-unreachable': 'off', - 'import/no-unresolved': 'off', - 'no-unused-vars': 'off', - 'no-confusing-arrow': 'off', - 'no-restricted-syntax': 'off', - 'react/jsx-one-expression-per-line': 'off', - 'guard-for-in': 'off', - 'no-nested-ternary': 'off', - 'no-underscore-dangle': 'off', - 'react/destructuring-assignment': 'off', - 'no-return-assign': 'off', - 'no-case-declarations': 'off', - 'react/no-array-index-key': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/ban-ts-ignore': 'off', - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/camelcase': 'off', - }, - settings: { - react: { - version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use - }, - }, -} diff --git a/web-app/package.json b/web-app/package.json index dd3c1d75..59558b08 100644 --- a/web-app/package.json +++ b/web-app/package.json @@ -25,15 +25,15 @@ "extends": "react-app" }, "dependencies": { - "@alifd/next": "^1.20.12", + "@alifd/next": "^1.20.14", "@alifd/theme-4": "^0.3.1", "@emotion/babel-preset-css-prop": "^10.0.27", "@emotion/core": "^10.0.28", - "@sentry/browser": "^5.17.0", + "@sentry/browser": "^5.18.1", "js-yaml": "^3.14.0", "markdown-it": "^11.0.0", "markdown-it-emoji": "^1.4.0", - "moment": "^2.26.0", + "moment": "^2.27.0", "prismjs": "^1.20.0", "react": "^16.13.1", "react-addons-css-transition-group": "^15.6.2", @@ -42,34 +42,34 @@ "xstate": "^4.10.0" }, "devDependencies": { - "@babel/core": "^7.10.2", + "@babel/core": "^7.10.3", "@storybook/addon-actions": "^5.3.19", "@storybook/addon-knobs": "^5.3.19", "@storybook/addon-links": "^5.3.19", "@storybook/addons": "^5.3.19", - "@storybook/preset-create-react-app": "^3.1.0", + "@storybook/preset-create-react-app": "^3.1.2", "@storybook/react": "^5.3.19", "@types/graphql": "^14.5.0", "@types/highlight.js": "^9.12.4", - "@types/jest": "^26.0.0", - "@types/js-yaml": "^3.12.4", + "@types/jest": "^26.0.3", + "@types/js-yaml": "^3.12.5", "@types/markdown-it": "^10.0.1", - "@types/node": "^14.0.13", + "@types/node": "^14.0.14", "@types/prismjs": "^1.16.1", - "@types/react": "^16.9.36", + "@types/react": "^16.9.41", "@types/react-addons-css-transition-group": "^15.0.5", "@types/react-dom": "^16.9.8", - "@typescript-eslint/eslint-plugin": "^3.3.0", - "@typescript-eslint/parser": "^3.3.0", + "@typescript-eslint/eslint-plugin": "^3.4.0", + "@typescript-eslint/parser": "^3.4.0", "babel-loader": "8.1.0", "babel-plugin-import": "^1.13.0", "customize-cra": "^1.0.0", - "eslint": "^7.2.0", + "eslint": "^7.3.1", "eslint-config-prettier": "^6.11.0", "eslint-plugin-prettier": "^3.1.4", "mini-css-extract-plugin": "^0.9.0", "node-sass": "^4.14.1", - "prettier": "^2.0.5", + "prettier": "2.0.5", "react-app-rewired": "^2.1.6", "react-scripts": "^3.4.1", "sass-loader": "^8.0.2", diff --git a/web-app/src/containers/Tutorial/components/Hints.tsx b/web-app/src/containers/Tutorial/components/Hints.tsx index 39acaef6..7e45fe35 100644 --- a/web-app/src/containers/Tutorial/components/Hints.tsx +++ b/web-app/src/containers/Tutorial/components/Hints.tsx @@ -32,6 +32,7 @@ const Hints = (props: Props) => { return (
+ {/* only show revealed hints */} {props.hints.map((h, i) => { return i <= hintIndex ? (
From ac4322475785ac39936022c9d1184bba259b0daf Mon Sep 17 00:00:00 2001 From: shmck Date: Sat, 27 Jun 2020 12:58:09 -0700 Subject: [PATCH 2/2] fix remaining lint issues Signed-off-by: shmck --- .eslintrc.js | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index c65aacf3..686eec15 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,6 +17,7 @@ module.exports = { '@typescript-eslint/ban-ts-ignore': 'off', '@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/camelcase': 'off', + '@typescript-eslint/ban-ts-comment': 'off', // 'react/forbid-component-props': [1, { forbid: ['style'] }], // 'react/forbid-dom-props': [1, { forbid: ['style'] }], }, diff --git a/package.json b/package.json index cac6b1b8..98d4941d 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "build": "./scripts/build.sh", "postinstall": "node ./node_modules/vscode/bin/install", "install-all": "yarn && yarn --cwd web-app", - "lint": "eslint src/**/*ts", + "lint": "eslint web-app/src/**/*.ts src/**/*.ts", "package": "./scripts/package.sh", "storybook": "yarn --cwd web-app storybook", "test": "jest",