style: format code

pull/4606/head
tangjinzhou 2021-09-01 23:48:26 +08:00
parent ed9bdd8923
commit 7764bfcc57
9 changed files with 48 additions and 40 deletions

View File

@ -11,13 +11,7 @@ module.exports = {
parserOptions: { parserOptions: {
parser: 'babel-eslint', parser: 'babel-eslint',
}, },
extends: [ extends: ['plugin:vue/vue3-recommended', 'prettier'],
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/typescript/recommended',
'@vue/prettier',
'@vue/prettier/@typescript-eslint',
],
plugins: ['markdown', 'jest', '@typescript-eslint'], plugins: ['markdown', 'jest', '@typescript-eslint'],
overrides: [ overrides: [
{ {
@ -47,6 +41,10 @@ module.exports = {
'@typescript-eslint/ban-ts-comment': 0, '@typescript-eslint/ban-ts-comment': 0,
}, },
}, },
{
files: ['*.vue'],
parser: 'vue-eslint-parser',
},
], ],
rules: { rules: {
'comma-dangle': [2, 'always-multiline'], 'comma-dangle': [2, 'always-multiline'],
@ -58,24 +56,25 @@ module.exports = {
camelcase: 'off', camelcase: 'off',
'no-extra-boolean-cast': 'off', 'no-extra-boolean-cast': 'off',
semi: ['error', 'always'], semi: ['error', 'always'],
// 'vue/require-explicit-emits': 'off', 'vue/no-v-html': 'off',
// 'vue/require-prop-types': 'off', 'vue/require-explicit-emits': 'off',
// 'vue/require-default-prop': 'off', 'vue/require-prop-types': 'off',
// 'vue/no-reserved-keys': 'off', 'vue/require-default-prop': 'off',
// 'vue/comment-directive': 'off', 'vue/no-reserved-keys': 'off',
// 'vue/prop-name-casing': 'off', 'vue/comment-directive': 'off',
// 'vue/one-component-per-file': 'off', 'vue/prop-name-casing': 'off',
// 'vue/custom-event-name-casing': 'off', 'vue/one-component-per-file': 'off',
// 'vue/max-attributes-per-line': [ 'vue/custom-event-name-casing': 'off',
// 2, 'vue/max-attributes-per-line': [
// { 2,
// singleline: 20, {
// multiline: { singleline: 20,
// max: 1, multiline: {
// allowFirstLine: false, max: 1,
// }, allowFirstLine: false,
// }, },
// ], },
],
}, },
globals: { globals: {
h: true, h: true,

View File

@ -2,8 +2,8 @@ import Button from '../index';
import SearchOutlined from '@ant-design/icons-vue/SearchOutlined'; import SearchOutlined from '@ant-design/icons-vue/SearchOutlined';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
import { asyncExpect, sleep } from '@/tests/utils'; import { asyncExpect, sleep } from '../../../tests/utils';
import mountTest from '@/tests/shared/mountTest'; import mountTest from '../../../tests/shared/mountTest';
import { resetWarned } from '../../_util/warning'; import { resetWarned } from '../../_util/warning';
describe('Button', () => { describe('Button', () => {
@ -27,7 +27,7 @@ describe('Button', () => {
expect(wrapper.find('.ant-btn-primary').exists()).toBe(true); expect(wrapper.find('.ant-btn-primary').exists()).toBe(true);
}); });
it('renders Chinese characters correctly', (done) => { it('renders Chinese characters correctly', done => {
const wrapper = mount({ const wrapper = mount({
render() { render() {
return <Button>按钮</Button>; return <Button>按钮</Button>;

View File

@ -1,6 +1,7 @@
import generateConfig from '../vc-picker/generate/dateFns'; import generateConfig from '../vc-picker/generate/dateFns';
import { withInstall } from '../_util/type'; import { withInstall } from '../_util/type';
import generateCalendar, { CalendarProps } from './generateCalendar'; import type { CalendarProps } from './generateCalendar';
import generateCalendar from './generateCalendar';
const Calendar = generateCalendar<Date>(generateConfig); const Calendar = generateCalendar<Date>(generateConfig);

View File

@ -1,7 +1,8 @@
import type { Dayjs } from 'dayjs'; import type { Dayjs } from 'dayjs';
import generateConfig from '../vc-picker/generate/dayjs'; import generateConfig from '../vc-picker/generate/dayjs';
import { withInstall } from '../_util/type'; import { withInstall } from '../_util/type';
import generateCalendar, { CalendarProps } from './generateCalendar'; import type { CalendarProps } from './generateCalendar';
import generateCalendar from './generateCalendar';
const Calendar = generateCalendar<Dayjs>(generateConfig); const Calendar = generateCalendar<Dayjs>(generateConfig);

View File

@ -1,7 +1,8 @@
import type { Moment } from 'moment'; import type { Moment } from 'moment';
import generateConfig from '../vc-picker/generate/moment'; import generateConfig from '../vc-picker/generate/moment';
import { withInstall } from '../_util/type'; import { withInstall } from '../_util/type';
import generateCalendar, { CalendarProps } from './generateCalendar'; import type { CalendarProps } from './generateCalendar';
import generateCalendar from './generateCalendar';
const Calendar = generateCalendar<Moment>(generateConfig); const Calendar = generateCalendar<Moment>(generateConfig);

View File

@ -1,7 +1,11 @@
import Menu, { MenuProps } from './src/Menu'; import type { MenuProps } from './src/Menu';
import MenuItem, { MenuItemProps } from './src/MenuItem'; import Menu from './src/Menu';
import SubMenu, { SubMenuProps } from './src/SubMenu'; import type { MenuItemProps } from './src/MenuItem';
import ItemGroup, { MenuItemGroupProps } from './src/ItemGroup'; import MenuItem from './src/MenuItem';
import type { SubMenuProps } from './src/SubMenu';
import SubMenu from './src/SubMenu';
import type { MenuItemGroupProps } from './src/ItemGroup';
import ItemGroup from './src/ItemGroup';
import Divider from './src/Divider'; import Divider from './src/Divider';
import type { App, Plugin } from 'vue'; import type { App, Plugin } from 'vue';
import type { MenuTheme } from './src/interface'; import type { MenuTheme } from './src/interface';

View File

@ -1,4 +1,5 @@
import Picker, { PickerProps } from './Picker'; import type { PickerProps } from './Picker';
import Picker from './Picker';
import PickerPanel from './PickerPanel'; import PickerPanel from './PickerPanel';
import RangePicker from './RangePicker'; import RangePicker from './RangePicker';
import type { PickerPanelProps } from './PickerPanel'; import type { PickerPanelProps } from './PickerPanel';

View File

@ -1,7 +1,8 @@
import TreeSelect from './TreeSelect'; import TreeSelect from './TreeSelect';
import TreeNode from './TreeNode'; import TreeNode from './TreeNode';
import { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } from './utils/strategyUtil'; import { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } from './utils/strategyUtil';
import { TreeSelectProps, treeSelectProps } from './props'; import type { TreeSelectProps } from './props';
import { treeSelectProps } from './props';
export { TreeNode, SHOW_ALL, SHOW_CHILD, SHOW_PARENT, treeSelectProps }; export { TreeNode, SHOW_ALL, SHOW_CHILD, SHOW_PARENT, treeSelectProps };
export type { TreeSelectProps }; export type { TreeSelectProps };

View File

@ -19,15 +19,15 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, computed } from 'vue'; import { defineComponent, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import GoogleAds from '../components/rice/GoogleAds.vue'; // import GoogleAds from '../components/rice/GoogleAds.vue';
const showAd = location.host.indexOf('antdv.com') > -1; const showAd = location.host.indexOf('antdv.com') > -1;
export default defineComponent({ export default defineComponent({
name: 'Demo', name: 'Demo',
props: ['pageData', 'isZhCN'],
components: { components: {
GoogleAds, // GoogleAds,
}, },
props: ['pageData', 'isZhCN'],
setup(props) { setup(props) {
const route = useRoute(); const route = useRoute();
const frontmatter = computed(() => props?.pageData?.frontmatter || {}); const frontmatter = computed(() => props?.pageData?.frontmatter || {});