diff --git a/.eslintrc b/.eslintrc index 4f04fec..bfd508a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,10 +14,6 @@ { "files": ["examples/normal-react/*.tsx"], "extends": ["zmi/react"] - }, - { - "files": ["examples/normal-vue/*.tsx", "examples/normal-vue/*.vue"], - "extends": ["zmi/vue"] } ] } diff --git a/examples/normal-react/package.json b/examples/normal-react/package.json index f58ccec..69acef7 100644 --- a/examples/normal-react/package.json +++ b/examples/normal-react/package.json @@ -18,5 +18,10 @@ "dependencies": { "react": "^17.0.1", "react-dom": "^17.0.1" + }, + "eslintConfig": { + "extends": [ + "zmi/react" + ] } } diff --git a/examples/normal-react/src/app.tsx b/examples/normal-react/src/app.tsx index 47c4c60..1f4b859 100644 --- a/examples/normal-react/src/app.tsx +++ b/examples/normal-react/src/app.tsx @@ -2,6 +2,8 @@ import React, { useState } from 'react' import logo from './logo.svg' import './app.less' +const b = 1 + function App() { const [count, setCount] = useState(1) diff --git a/examples/normal-vue/.eslintrc b/examples/normal-vue/.eslintrc new file mode 100644 index 0000000..fdcc938 --- /dev/null +++ b/examples/normal-vue/.eslintrc @@ -0,0 +1,4 @@ +{ + "root": true, + "extends": ["zmi/vue"] +} diff --git a/examples/normal-vue/src/home.vue b/examples/normal-vue/src/home.vue index ebd8327..ce55cf1 100644 --- a/examples/normal-vue/src/home.vue +++ b/examples/normal-vue/src/home.vue @@ -8,7 +8,7 @@ import { defineComponent } from 'vue' export default defineComponent({ - name: 'Home', + name: 'home', data() { return { msg: 'hello vue 3' diff --git a/examples/normal-vue/src/index.ts b/examples/normal-vue/src/index.ts index 19dbbcd..8d3e78f 100644 --- a/examples/normal-vue/src/index.ts +++ b/examples/normal-vue/src/index.ts @@ -1,6 +1,4 @@ import { createApp } from 'vue' -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore import App from './tsx' createApp(App).mount('#root') diff --git a/examples/normal-vue/src/tsx.tsx b/examples/normal-vue/src/tsx.tsx index ec5779a..860236f 100644 --- a/examples/normal-vue/src/tsx.tsx +++ b/examples/normal-vue/src/tsx.tsx @@ -25,7 +25,9 @@ export default defineComponent({
{this.tsx}
{this.count}
- + {/* {[1, 2].map((i) => { + return
{i}
+ })} */}
) diff --git a/packages/zmi-webpack/fixtures/react-config/dist/main.js b/packages/zmi-webpack/fixtures/react-config/dist/main.js new file mode 100644 index 0000000..fa05f10 --- /dev/null +++ b/packages/zmi-webpack/fixtures/react-config/dist/main.js @@ -0,0 +1,6 @@ +;(() => { + 'use strict' + const o = {} + var s = 1 + console.log(s, o) +})() diff --git a/packages/zmi-webpack/fixtures/vue-config/dist/main.js b/packages/zmi-webpack/fixtures/vue-config/dist/main.js new file mode 100644 index 0000000..2a0856b --- /dev/null +++ b/packages/zmi-webpack/fixtures/vue-config/dist/main.js @@ -0,0 +1,3 @@ +;(() => { + 'use strict' +})() diff --git a/packages/zmi-webpack/package.json b/packages/zmi-webpack/package.json index 32c2b59..985dfb0 100644 --- a/packages/zmi-webpack/package.json +++ b/packages/zmi-webpack/package.json @@ -30,7 +30,7 @@ "css-minimizer-webpack-plugin": "^1.2.0", "css-modules-typescript-loader": "^4.0.1", "eslint": "^7.21.0", - "eslint-config-zmi": "^1.1.5", + "eslint-config-zmi": "^1.1.6", "eslint-webpack-plugin": "^2.5.2", "file-loader": "^6.2.0", "fork-ts-checker-webpack-plugin": "^6.1.1", diff --git a/packages/zmi-webpack/src/applyPlugin.ts b/packages/zmi-webpack/src/applyPlugin.ts index 25df0af..0776f56 100644 --- a/packages/zmi-webpack/src/applyPlugin.ts +++ b/packages/zmi-webpack/src/applyPlugin.ts @@ -102,7 +102,7 @@ async function applyPlugin(options: IPenetrateOptions) { context: cwd, cwd, cache: true, - useEslintrc: false, + // useEslintrc: false, failOnError: isDev, resolvePluginsRelativeTo: __dirname, cacheLocation: path.join(cwd, 'node_modules/.cache/.eslintcache'), diff --git a/scripts/cleanModules.js b/scripts/cleanModules.js index 41467af..0da44c0 100644 --- a/scripts/cleanModules.js +++ b/scripts/cleanModules.js @@ -9,10 +9,7 @@ exec('lerna clean --ignore @zmi-cli/webpack --yes', (err, stdout, stderr) => { console.log(stdout) console.log(stderr) // will cause webpack types errors - const webpackTypes = path.join( - __dirname, - '../packages/zmi-webpack/node_modules/@types' - ) + const webpackTypes = path.join(__dirname, '../packages/zmi-webpack/node_modules/@types') rimraf.sync(webpackTypes) console.log(`clean removing ${webpackTypes}`) } diff --git a/yarn.lock b/yarn.lock index 2494623..9478e8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5564,10 +5564,10 @@ eslint-config-prettier@^8.1.0: resolved "https://registry.npm.taobao.org/eslint-config-prettier/download/eslint-config-prettier-8.1.0.tgz?cache=0&sync_timestamp=1614187358311&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feslint-config-prettier%2Fdownload%2Feslint-config-prettier-8.1.0.tgz#4ef1eaf97afe5176e6a75ddfb57c335121abc5a6" integrity sha1-TvHq+Xr+UXbmp13ftXwzUSGrxaY= -eslint-config-zmi@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/eslint-config-zmi/-/eslint-config-zmi-1.1.5.tgz#84bb623be42a435de5efd4d7e1f57e3af5f1e588" - integrity sha512-zXhDMjK5+81ise6Gu+TX5OF0DkXamprzvTH9lASGRaQGaH0E+XLORJFnc3ZiwP08VNTYqVQRiVKNaImsHdK4nQ== +eslint-config-zmi@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/eslint-config-zmi/-/eslint-config-zmi-1.1.6.tgz#8df3930765d06a224bbd057c3b4073bbbf25b081" + integrity sha512-UkVb00F0a8O3tE8SIBraLlGbTbDZpqboqxshpPSCMNVwAz4v5cJsHCDqQniE37QWgkTD9HcpToici6IzA9C6Ug== dependencies: "@typescript-eslint/eslint-plugin" "^4.16.1" "@typescript-eslint/parser" "^4.16.1"