chore(eslint-config): update dependencies test cases (#10221)

* chore(eslint-config): update dependencies, test cases

* chore: update file .lock

* fix: wrong .lock file

* fix: code style

* chore: update `eslint-plugin-vue`
This commit is contained in:
zoy-l 2022-01-30 11:13:54 +08:00 committed by GitHub
parent f65c4198dc
commit 07dfa9b981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 6249 additions and 1805 deletions

View File

@ -0,0 +1,4 @@
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
resolver: '<rootDir>/jest.resolver.js',
};

View File

@ -0,0 +1,13 @@
// 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);
};

View File

@ -7,6 +7,10 @@
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"scripts": {
"update:deps": "pnpm update --latest --interactive",
"test": "jest"
},
"repository": {
"type": "git",
"url": "https://github.com/youzan/vant.git",
@ -16,15 +20,19 @@
"author": "chenjiahan",
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.3.1",
"@typescript-eslint/parser": "5.3.1",
"eslint-config-airbnb-base": "^14.2.1",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-vue": "^7.18.0"
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-vue": "^8.4.0"
},
"devDependencies": {
"eslint": "^8.0.0",
"typescript": "~4.5.2"
"enhanced-resolve": "^5.8.3",
"eslint": "^8.7.0",
"typescript": "~4.5.5"
},
"peerDependencies": {
"eslint": "^7.32.0 || ^8.2.0"
}
}

View File

@ -20,9 +20,11 @@ async function lintProject(name) {
test('a vue project should pass lint', async () => {
const rest = await lintProject('vue');
expect([
'no-const-assign',
'@typescript-eslint/no-unused-vars',
'vue/multi-word-component-names',
'no-undef',
]).toEqual(rest);
});
@ -32,6 +34,7 @@ test('a vue-tsx project should pass lint', async () => {
expect([
'@typescript-eslint/no-unused-vars',
'vue/multi-word-component-names',
'vue/no-ref-as-operand',
'@typescript-eslint/no-empty-interface',
]).toEqual(rest);

View File

@ -8,6 +8,7 @@
const a = 1;
a = 1;
export default {
name: 'Todo',
data() {
return {
arr: [1, 2, 3],

View File

@ -310,7 +310,9 @@ export default defineComponent({
watch(
() => props.columnsNum,
() => nextTick(setValues)
() => {
nextTick(setValues);
}
);
useExpose({ reset, getArea, getValues });

View File

@ -33,7 +33,8 @@ export function runRuleValidator(value: unknown, rule: FieldRule) {
const returnVal = rule.validator!(value, rule);
if (isPromise(returnVal)) {
return returnVal.then(resolve);
returnVal.then(resolve);
return;
}
resolve(returnVal);

View File

@ -107,12 +107,17 @@ test('should support async validator in rules prop', async () => {
validator: (value, rule) => {
expect(value).toEqual('123');
expect(typeof rule).toEqual('object');
return new Promise((resolve) => resolve(true));
return new Promise((resolve) => {
resolve(true);
});
},
message: 'should pass',
},
{
validator: () => new Promise((resolve) => resolve(false)),
validator: () =>
new Promise((resolve) => {
resolve(false);
}),
message: 'should fail',
},
];

View File

@ -162,7 +162,9 @@ export default defineComponent({
}
};
const init = () => nextTick(onScroll);
const init = () => {
nextTick(onScroll);
};
useEventListener('scroll', onScroll, { target: scrollParent });

View File

@ -426,7 +426,10 @@ test('before-delete prop resolved', async () => {
const wrapper = mount(Uploader, {
props: {
modelValue: [{ url: IMAGE }],
beforeDelete: () => new Promise<boolean>((resolve) => resolve(true)),
beforeDelete: () =>
new Promise<boolean>((resolve) => {
resolve(true);
}),
},
});
@ -439,7 +442,10 @@ test('before-delete prop rejected', async () => {
const wrapper = mount(Uploader, {
props: {
modelValue: [{ url: IMAGE }],
beforeDelete: () => new Promise<boolean>((resolve, reject) => reject()),
beforeDelete: () =>
new Promise<boolean>((resolve, reject) => {
reject();
}),
},
});

7981
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff