mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: extend eslint range to all src, test directories (#12055)
* chore: extend eslint range to all src, test directories * chore: fix range
This commit is contained in:
parent
9333633406
commit
523844eae4
@ -3,7 +3,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"dev": "pnpm --dir ./packages/vant dev",
|
"dev": "pnpm --dir ./packages/vant dev",
|
||||||
"lint": "pnpm --dir ./packages/vant lint",
|
"lint": "eslint ./packages/**/src ./packages/**/test --ext .js,.ts,.tsx,.vue,.mjs,.cjs",
|
||||||
"test": "pnpm --dir ./packages/vant test",
|
"test": "pnpm --dir ./packages/vant test",
|
||||||
"test:watch": "pnpm --dir ./packages/vant test:watch",
|
"test:watch": "pnpm --dir ./packages/vant test:watch",
|
||||||
"test:update": "pnpm --dir ./packages/vant test:update",
|
"test:update": "pnpm --dir ./packages/vant test:update",
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"root": true,
|
|
||||||
"extends": ["@vant"]
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
/** @type {import('@jest/types').Config.InitialOptions} */
|
|
||||||
module.exports = {
|
|
||||||
resolver: '<rootDir>/jest.resolver.js',
|
|
||||||
};
|
|
@ -1,13 +0,0 @@
|
|||||||
// https://github.com/facebook/jest/issues/9771#issuecomment-871585234
|
|
||||||
const resolver = require('enhanced-resolve').create.sync({
|
|
||||||
conditionNames: ['require', 'node', 'default'],
|
|
||||||
extensions: ['.js', '.json', '.node', '.ts', '.tsx'],
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = function (request, options) {
|
|
||||||
// list global module that must be resolved by defaultResolver here
|
|
||||||
if (['fs', 'http', 'path'].includes(request)) {
|
|
||||||
return options.defaultResolver(request, options);
|
|
||||||
}
|
|
||||||
return resolver(options.basedir, request);
|
|
||||||
};
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"root": true,
|
|
||||||
"extends": ["../index"]
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
const { ESLint } = require('eslint');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const eslint = new ESLint();
|
|
||||||
|
|
||||||
async function lintProject(name) {
|
|
||||||
const projectPath = path.resolve(__dirname, name);
|
|
||||||
const filesToLint = path.resolve(projectPath, '**');
|
|
||||||
const rest = await eslint.lintFiles(filesToLint);
|
|
||||||
const ruleId = [];
|
|
||||||
rest.forEach((res) =>
|
|
||||||
res.messages.forEach((msg) => {
|
|
||||||
if (ruleId.indexOf(msg.ruleId) < 0) {
|
|
||||||
ruleId.push(msg.ruleId);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
return ruleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
test('a vue project should pass lint', async () => {
|
|
||||||
const rest = await lintProject('vue');
|
|
||||||
|
|
||||||
expect([
|
|
||||||
'no-const-assign',
|
|
||||||
'@typescript-eslint/no-unused-vars',
|
|
||||||
'no-undef',
|
|
||||||
]).toEqual(rest);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a vue-tsx project should pass lint', async () => {
|
|
||||||
const rest = await lintProject('vue-tsx');
|
|
||||||
|
|
||||||
expect([
|
|
||||||
'@typescript-eslint/no-unused-vars',
|
|
||||||
'vue/no-ref-as-operand',
|
|
||||||
'@typescript-eslint/no-empty-interface',
|
|
||||||
]).toEqual(rest);
|
|
||||||
});
|
|
@ -1,12 +0,0 @@
|
|||||||
import { defineComponent } from 'vue';
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: 'App',
|
|
||||||
setup() {
|
|
||||||
return () => (
|
|
||||||
<>
|
|
||||||
<h1>App</h1>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
});
|
|
@ -1,23 +0,0 @@
|
|||||||
import { defineComponent, ref } from 'vue';
|
|
||||||
import App from './app';
|
|
||||||
|
|
||||||
const h2 = 1;
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: 'Index',
|
|
||||||
setup() {
|
|
||||||
const count = ref(0);
|
|
||||||
|
|
||||||
count++;
|
|
||||||
count + 1;
|
|
||||||
1 + count;
|
|
||||||
|
|
||||||
return () => (
|
|
||||||
<>
|
|
||||||
<h1>About</h1>
|
|
||||||
|
|
||||||
<App />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
});
|
|
@ -1 +0,0 @@
|
|||||||
interface Foo {}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "esnext",
|
|
||||||
"module": "esnext",
|
|
||||||
"strict": true,
|
|
||||||
"jsx": "preserve",
|
|
||||||
"importHelpers": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"baseUrl": ".",
|
|
||||||
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
|
|
||||||
},
|
|
||||||
"include": ["**/*.ts", "**/*.tsx", "**/*.vue"],
|
|
||||||
"exclude": ["node_modules"]
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<span v-for="a in arr">{{ a }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const a = 1;
|
|
||||||
a = 1;
|
|
||||||
export default {
|
|
||||||
name: 'Todo',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
arr: [1, 2, 3],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style></style>
|
|
@ -1,2 +0,0 @@
|
|||||||
const a = b + 1;
|
|
||||||
export default a;
|
|
Loading…
x
Reference in New Issue
Block a user