From c54db99e7b8e54e048582b7d78a4b565c4d3678d Mon Sep 17 00:00:00 2001 From: Mirone Saul Date: Mon, 21 Nov 2022 15:11:24 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20improve=20eslint=20rule?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintignore | 5 - .eslintrc.js | 41 +- examples/vue/App.vue | 22 +- examples/vue/CodeFence/CodeFence.vue | 171 +++---- examples/vue/Milkdown.vue | 107 ++-- examples/vue/VueEditor.tsx | 17 +- package.json | 8 +- packages/react/src/Editor.tsx | 13 +- packages/react/src/EditorComponent.tsx | 1 + packages/react/src/Portals.tsx | 1 + packages/vue/src/Editor.tsx | 2 +- packages/vue/src/EditorComponent.tsx | 4 +- packages/vue/src/VueNode.tsx | 5 +- packages/vue/src/VueNodeView.tsx | 2 +- pnpm-lock.yaml | 663 ++++++++++++++----------- 15 files changed, 577 insertions(+), 485 deletions(-) delete mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 6fb7e3f951e..00000000000 --- a/.eslintignore +++ /dev/null @@ -1,5 +0,0 @@ -lib -node_modules -docs -dist -snapshots.js diff --git a/.eslintrc.js b/.eslintrc.js index 14f51e354dd..500e3ec064e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,24 +1,39 @@ /* Copyright 2021, Milkdown by Mirone. */ module.exports = { - extends: ['@antfu/eslint-config-ts', 'plugin:react-hooks/recommended'], - plugins: ['header', 'eslint-plugin-tsdoc'], - rules: { - 'tsdoc/syntax': 'warn', - 'yml/no-empty-mapping-value': 'off', - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/consistent-type-definitions': 'off', - }, + extends: [ + '@antfu', + ], + plugins: ['header'], settings: { react: { version: 'detect', }, }, + ignorePatterns: [ + 'lib', + 'snapshots.js', + 'docs', + ], + rules: { + 'yml/no-empty-mapping-value': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/consistent-type-definitions': 'off', + }, overrides: [ { - files: ['**/vue/**/*.tsx'], + files: ['**/react/**/*.tsx', '**/react/**/*.ts'], + extends: [ + 'plugin:react/recommended', + 'plugin:react-hooks/recommended', + ], rules: { - 'react-hooks/rules-of-hooks': 'off', + 'jsx-quotes': [ + 'error', + 'prefer-double', + ], + 'react/react-in-jsx-scope': 'off', + 'react/prop-types': 'off', }, }, { @@ -30,11 +45,7 @@ module.exports = { { files: ['**/*.ts', '**/*.tsx', '**/*.js'], rules: { - 'header/header': [ - 'error', - 'block', - ' Copyright 2021, Milkdown by Mirone. ', - ], + 'header/header': ['error', 'block', ' Copyright 2021, Milkdown by Mirone. '], }, }, ], diff --git a/examples/vue/App.vue b/examples/vue/App.vue index cfacdc8aaa0..a3d8cd90159 100644 --- a/examples/vue/App.vue +++ b/examples/vue/App.vue @@ -1,14 +1,14 @@ - - + + diff --git a/examples/vue/CodeFence/CodeFence.vue b/examples/vue/CodeFence/CodeFence.vue index f085a9aa4e3..02aad20b1f8 100644 --- a/examples/vue/CodeFence/CodeFence.vue +++ b/examples/vue/CodeFence/CodeFence.vue @@ -1,108 +1,109 @@