@zipify/wysiwyg 4.9.1 → 4.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/actions/lint-js/action.yaml +8 -3
- package/.lintstagedrc.mjs +32 -0
- package/.oxlintrc.json +185 -0
- package/dist/assets/wysiwyg--9T2Gngx.css +940 -0
- package/dist/assets/wysiwyg-yoEkrvE8.css +940 -0
- package/dist/cli.js +35 -35
- package/dist/node.js +22 -22
- package/dist/wysiwyg.mjs +2010 -1217
- package/eslint.config.mjs +6 -0
- package/lib/Wysiwyg.vue +1 -2
- package/lib/cli/commands/Command.js +1 -2
- package/lib/components/base/Checkbox.vue +3 -0
- package/lib/components/base/Modal.vue +1 -1
- package/lib/components/toolbar/controls/__tests__/FontColorControl.test.js +2 -2
- package/lib/components/toolbar/controls/link/LinkControlHeader.vue +7 -2
- package/lib/components/toolbar/controls/link/__tests__/LinkControl.test.js +5 -5
- package/lib/components/toolbar/controls/link/__tests__/LinkControlHeader.test.js +4 -4
- package/lib/extensions/FontStyle.js +3 -3
- package/lib/extensions/__tests__/StylePreset.test.js +5 -5
- package/lib/extensions/list/List.js +3 -3
- package/lib/extensions/list/__tests__/List.test.js +4 -4
- package/lib/services/JsonSerializer.js +0 -1
- package/lib/services/Storage.js +0 -1
- package/lib/services/__tests__/Storage.test.js +9 -4
- package/lib/services/normalizer/__tests__/HtmlNormalizer.test.js +25 -25
- package/package.json +3 -13
- package/tsconfig.lint.json +7 -0
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -95
- package/.lintstagedrc +0 -12
package/lib/Wysiwyg.vue
CHANGED
|
@@ -124,7 +124,7 @@ const props = defineProps({
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
const emit = defineEmits(
|
|
127
|
+
const emit = defineEmits([
|
|
128
128
|
'update-favorite-colors'
|
|
129
129
|
]);
|
|
130
130
|
|
|
@@ -179,7 +179,6 @@ const favoriteColors = new FavoriteColors({
|
|
|
179
179
|
});
|
|
180
180
|
|
|
181
181
|
// Requires a lot of effort to add types right now
|
|
182
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
183
182
|
// @ts-expect-error
|
|
184
183
|
const getContentCustomization = () => editor.commands.getContentCustomization();
|
|
185
184
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import { h, ref } from 'vue';
|
|
3
|
-
import { InjectionTokens } from '
|
|
3
|
+
import { InjectionTokens } from '@/injectionTokens';
|
|
4
4
|
import { ColorPicker } from '../../../base';
|
|
5
5
|
import FontColorControl from '../FontColorControl';
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ const SELECTORS = {
|
|
|
11
11
|
const createEditor = ({ fontColor, isSettingCustomized } = {}) => ({
|
|
12
12
|
commands: {
|
|
13
13
|
getFontColor: () => ref(fontColor),
|
|
14
|
-
isSettingCustomized: () => ref(
|
|
14
|
+
isSettingCustomized: () => ref(isSettingCustomized ?? false),
|
|
15
15
|
focus: jest.fn().mockReturnThis(),
|
|
16
16
|
applyFontColor: jest.fn().mockReturnThis(),
|
|
17
17
|
run: jest.fn()
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
Link
|
|
5
5
|
</span>
|
|
6
6
|
|
|
7
|
-
<Button
|
|
7
|
+
<Button
|
|
8
|
+
class="zw-link-modal-header__unlink-button"
|
|
9
|
+
:disabled="!isLink"
|
|
10
|
+
data-initial-focus="false"
|
|
11
|
+
@click="removeLink"
|
|
12
|
+
>
|
|
8
13
|
<Icon class="zw-link-modal-header__unlink-icon" name="unlink" size="14px" auto-color />
|
|
9
14
|
Remove
|
|
10
15
|
</Button>
|
|
@@ -14,7 +19,7 @@
|
|
|
14
19
|
<script setup>
|
|
15
20
|
import { inject } from 'vue';
|
|
16
21
|
import { Icon, Button } from '../../../base';
|
|
17
|
-
import { InjectionTokens } from '
|
|
22
|
+
import { InjectionTokens } from '@/injectionTokens';
|
|
18
23
|
|
|
19
24
|
const emit = defineEmits(['remove-link']);
|
|
20
25
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import { ref, nextTick } from 'vue';
|
|
3
3
|
import LinkControl from '../LinkControl';
|
|
4
|
-
import { InjectionTokens } from '
|
|
4
|
+
import { InjectionTokens } from '@/injectionTokens';
|
|
5
5
|
import { Button, TextField } from '../../../../base';
|
|
6
6
|
import { LinkControlDestination } from '../destination';
|
|
7
7
|
|
|
@@ -26,7 +26,7 @@ const SELECTORS = {
|
|
|
26
26
|
|
|
27
27
|
describe('selection value', () => {
|
|
28
28
|
test('should render link status', () => {
|
|
29
|
-
const editor = createEditor(true
|
|
29
|
+
const editor = createEditor(true);
|
|
30
30
|
const wrapper = createComponent({ editor });
|
|
31
31
|
const buttonWrapper = wrapper.findComponent(Button);
|
|
32
32
|
|
|
@@ -36,7 +36,7 @@ describe('selection value', () => {
|
|
|
36
36
|
|
|
37
37
|
describe('validation', () => {
|
|
38
38
|
test('should show error on apply', async () => {
|
|
39
|
-
const editor = createEditor(true
|
|
39
|
+
const editor = createEditor(true);
|
|
40
40
|
const wrapper = createComponent({ editor });
|
|
41
41
|
const textFieldWrapper = wrapper.findComponent(TextField);
|
|
42
42
|
const linkControlDestinationWrapper = wrapper.findComponent(LinkControlDestination);
|
|
@@ -49,7 +49,7 @@ describe('validation', () => {
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
test('should reset errors on input', async () => {
|
|
52
|
-
const editor = createEditor(true
|
|
52
|
+
const editor = createEditor(true);
|
|
53
53
|
const wrapper = createComponent({ editor });
|
|
54
54
|
const textFieldWrapper = wrapper.findComponent(TextField);
|
|
55
55
|
const linkControlDestinationWrapper = wrapper.findComponent(LinkControlDestination);
|
|
@@ -64,7 +64,7 @@ describe('validation', () => {
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
test('should reset errors on change destination', async () => {
|
|
67
|
-
const editor = createEditor(true
|
|
67
|
+
const editor = createEditor(true);
|
|
68
68
|
const wrapper = createComponent({ editor });
|
|
69
69
|
const textFieldWrapper = wrapper.findComponent(TextField);
|
|
70
70
|
const linkControlDestinationWrapper = wrapper.findComponent(LinkControlDestination);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { InjectionTokens } from '
|
|
2
|
+
import { InjectionTokens } from '@/injectionTokens';
|
|
3
3
|
import { Button } from '../../../../base';
|
|
4
4
|
import LinkControlHeader from '../LinkControlHeader';
|
|
5
5
|
|
|
@@ -17,7 +17,7 @@ function createComponent({ editor }) {
|
|
|
17
17
|
|
|
18
18
|
describe('rendering unlink button', () => {
|
|
19
19
|
test('should button be disabled when no link', () => {
|
|
20
|
-
const editor = createEditor(true
|
|
20
|
+
const editor = createEditor(true);
|
|
21
21
|
const wrapper = createComponent({ editor });
|
|
22
22
|
const buttonWrapper = wrapper.findComponent(Button);
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ describe('rendering unlink button', () => {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
test('should button be enabled when link selected', () => {
|
|
28
|
-
const editor = createEditor(false
|
|
28
|
+
const editor = createEditor(false);
|
|
29
29
|
const wrapper = createComponent({ editor });
|
|
30
30
|
const buttonWrapper = wrapper.findComponent(Button);
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ describe('rendering unlink button', () => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
test('should send unlink event', () => {
|
|
36
|
-
const editor = createEditor(true
|
|
36
|
+
const editor = createEditor(true);
|
|
37
37
|
const wrapper = createComponent({ editor });
|
|
38
38
|
const buttonWrapper = wrapper.findComponent(Button);
|
|
39
39
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Mark } from '@tiptap/vue-3';
|
|
2
2
|
import { computed, unref } from 'vue';
|
|
3
|
-
import { createCommand, createKeyboardShortcut, renderMark } from '
|
|
4
|
-
import { MarkGroups, TextSettings } from '
|
|
3
|
+
import { createCommand, createKeyboardShortcut, renderMark } from '@/utils';
|
|
4
|
+
import { MarkGroups, TextSettings } from '@/enums';
|
|
5
5
|
|
|
6
6
|
export const FontStyle = Mark.create({
|
|
7
7
|
name: TextSettings.FONT_STYLE,
|
|
@@ -64,7 +64,7 @@ export const FontStyle = Mark.create({
|
|
|
64
64
|
}),
|
|
65
65
|
|
|
66
66
|
parseHTML() {
|
|
67
|
-
const getAttrs = (value) => ({ italic: value.includes('italic')
|
|
67
|
+
const getAttrs = (value) => ({ italic: value.includes('italic') });
|
|
68
68
|
|
|
69
69
|
return [
|
|
70
70
|
{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Editor, Extension, Mark } from '@tiptap/vue-3';
|
|
2
|
-
import { buildTestExtensions } from '
|
|
2
|
+
import { buildTestExtensions } from '@/__tests__/utils';
|
|
3
3
|
import { StylePreset } from '../StylePreset';
|
|
4
4
|
import { List } from '../list';
|
|
5
|
-
import { ListTypes, NodeTypes, TextSettings } from '
|
|
6
|
-
import { ContentNormalizer, NodeFactory } from '
|
|
7
|
-
import { createCommand } from '
|
|
5
|
+
import { ListTypes, NodeTypes, TextSettings } from '@/enums';
|
|
6
|
+
import { ContentNormalizer, NodeFactory } from '@/services';
|
|
7
|
+
import { createCommand } from '@/utils';
|
|
8
8
|
|
|
9
9
|
const MockFontSize = Mark.create({
|
|
10
10
|
name: TextSettings.FONT_SIZE,
|
|
@@ -129,7 +129,7 @@ function createEditor({ content, presets, defaultId, link }) {
|
|
|
129
129
|
defaultId,
|
|
130
130
|
|
|
131
131
|
styleRenderer: {
|
|
132
|
-
makePresetHtmlClass: (preset) =>
|
|
132
|
+
makePresetHtmlClass: (preset) => `zw ts-${preset.id}`,
|
|
133
133
|
makePresetCssClass: (preset) => `.zw.ts-${preset.id}`,
|
|
134
134
|
inject: jest.fn()
|
|
135
135
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Node, wrappingInputRule } from '@tiptap/vue-3';
|
|
2
2
|
import { computed, unref } from 'vue';
|
|
3
|
-
import { copyMark, createCommand } from '
|
|
4
|
-
import { ListTypes, MarkGroups, NodeTypes, TextSettings } from '
|
|
3
|
+
import { copyMark, createCommand } from '@/utils';
|
|
4
|
+
import { ListTypes, MarkGroups, NodeTypes, TextSettings } from '@/enums';
|
|
5
5
|
import { ListItem } from './ListItem';
|
|
6
6
|
|
|
7
7
|
export const List = Node.create({
|
|
@@ -29,7 +29,7 @@ export const List = Node.create({
|
|
|
29
29
|
const HTML_TYPES = {
|
|
30
30
|
a: ListTypes.ROMAN,
|
|
31
31
|
i: ListTypes.LATIN,
|
|
32
|
-
|
|
32
|
+
1: ListTypes.DECIMAL
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const getBulletType = (element) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Editor, Mark } from '@tiptap/vue-3';
|
|
2
|
-
import { buildTestExtensions } from '
|
|
3
|
-
import { ListTypes, TextSettings } from '
|
|
2
|
+
import { buildTestExtensions } from '@/__tests__/utils';
|
|
3
|
+
import { ListTypes, TextSettings } from '@/enums';
|
|
4
4
|
import { StylePreset } from '../../StylePreset';
|
|
5
|
-
import { ContentNormalizer, NodeFactory } from '
|
|
5
|
+
import { ContentNormalizer, NodeFactory } from '@/services';
|
|
6
6
|
import { List } from '../List';
|
|
7
7
|
|
|
8
8
|
const MockFontWeight = Mark.create({
|
|
@@ -31,7 +31,7 @@ function createEditor({ content }) {
|
|
|
31
31
|
defaultId: 'regular-1',
|
|
32
32
|
|
|
33
33
|
styleRenderer: {
|
|
34
|
-
makePresetHtmlClass: (preset) =>
|
|
34
|
+
makePresetHtmlClass: (preset) => `zw ts-${preset.id}`,
|
|
35
35
|
makePresetCssClass: (preset) => `.zw.ts-${preset.id}`,
|
|
36
36
|
render: () => ''
|
|
37
37
|
}
|
package/lib/services/Storage.js
CHANGED
|
@@ -38,10 +38,12 @@ describe('get item', () => {
|
|
|
38
38
|
const storage = createStorage({ storage: nativeStorage });
|
|
39
39
|
const error = new Error('private mode');
|
|
40
40
|
|
|
41
|
-
nativeStorage.getItem.mockImplementation(() => {
|
|
41
|
+
nativeStorage.getItem.mockImplementation(() => {
|
|
42
|
+
throw error;
|
|
43
|
+
});
|
|
44
|
+
|
|
42
45
|
storage.getItem('test');
|
|
43
46
|
|
|
44
|
-
// eslint-disable-next-line no-console
|
|
45
47
|
expect(console.error).toHaveBeenCalledWith(error);
|
|
46
48
|
});
|
|
47
49
|
});
|
|
@@ -70,10 +72,13 @@ describe('set item', () => {
|
|
|
70
72
|
const storage = createStorage({ storage: nativeStorage });
|
|
71
73
|
const error = new Error('private mode');
|
|
72
74
|
|
|
73
|
-
nativeStorage.getItem.mockImplementation(() => {
|
|
75
|
+
nativeStorage.getItem.mockImplementation(() => {
|
|
76
|
+
throw error;
|
|
77
|
+
});
|
|
78
|
+
|
|
74
79
|
storage.setItem('test', 'test');
|
|
75
80
|
|
|
76
|
-
|
|
81
|
+
|
|
77
82
|
expect(console.error).toHaveBeenCalledWith(error);
|
|
78
83
|
});
|
|
79
84
|
});
|
|
@@ -24,28 +24,28 @@ describe('normalize text content', () => {
|
|
|
24
24
|
|
|
25
25
|
test('should keep order in list nodes', () => {
|
|
26
26
|
const input = '<ul><li style="line-height: 2;"><span style="font-weight: 700">lorem</span> impsum</li></ul>';
|
|
27
|
-
const output = '<ul>'
|
|
28
|
-
'<li>'
|
|
29
|
-
|
|
30
|
-
'</li>'
|
|
31
|
-
|
|
27
|
+
const output = '<ul>'
|
|
28
|
+
+ '<li>'
|
|
29
|
+
+ '<p style="line-height: 2;"><span style="font-weight: 700">lorem</span> impsum</p>'
|
|
30
|
+
+ '</li>'
|
|
31
|
+
+ '</ul>';
|
|
32
32
|
|
|
33
33
|
expect(ContentNormalizer.normalize(input)).toBe(output);
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
test('should wrap non paragraph list content', () => {
|
|
37
|
-
const input = '<ul>'
|
|
38
|
-
'<li style="line-height: 2;">'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'</li>'
|
|
42
|
-
|
|
43
|
-
const output = '<ul>'
|
|
44
|
-
'<li>'
|
|
45
|
-
'<p style="line-height: 2;"><span style="font-weight: 700">lorem</span> impsum</p>'
|
|
46
|
-
'<p style="line-height: 2;">paragraph text</p>'
|
|
47
|
-
'</li>'
|
|
48
|
-
|
|
37
|
+
const input = '<ul>'
|
|
38
|
+
+ '<li style="line-height: 2;">'
|
|
39
|
+
+ '<span style="font-weight: 700">lorem</span> impsum'
|
|
40
|
+
+ '<p>paragraph text</p>'
|
|
41
|
+
+ '</li>'
|
|
42
|
+
+ '</ul>';
|
|
43
|
+
const output = '<ul>'
|
|
44
|
+
+ '<li>'
|
|
45
|
+
+ '<p style="line-height: 2;"><span style="font-weight: 700">lorem</span> impsum</p>'
|
|
46
|
+
+ '<p style="line-height: 2;">paragraph text</p>'
|
|
47
|
+
+ '</li>'
|
|
48
|
+
+ '</ul>';
|
|
49
49
|
|
|
50
50
|
expect(ContentNormalizer.normalize(input)).toBe(output);
|
|
51
51
|
});
|
|
@@ -114,10 +114,10 @@ describe('normalize text content', () => {
|
|
|
114
114
|
|
|
115
115
|
test('should normalize br in list items', () => {
|
|
116
116
|
const input = '<ul><li>lorem ipsum 1<br><br></li><li>lorem ipsum 2</li></ul>';
|
|
117
|
-
const output = '<ul>'
|
|
118
|
-
'<li><p>lorem ipsum 1</p><p><br></p></li>'
|
|
119
|
-
'<li><p>lorem ipsum 2</p></li>'
|
|
120
|
-
|
|
117
|
+
const output = '<ul>'
|
|
118
|
+
+ '<li><p>lorem ipsum 1</p><p><br></p></li>'
|
|
119
|
+
+ '<li><p>lorem ipsum 2</p></li>'
|
|
120
|
+
+ '</ul>';
|
|
121
121
|
|
|
122
122
|
expect(ContentNormalizer.normalize(input)).toBe(output);
|
|
123
123
|
});
|
|
@@ -145,10 +145,10 @@ describe('normalize text content', () => {
|
|
|
145
145
|
|
|
146
146
|
test('should move text decoration from block to mixed content', () => {
|
|
147
147
|
const input = '<p style="text-decoration: underline;"><span style="text-decoration: line-through;">lorem</span> ipsum</p>';
|
|
148
|
-
const output = '<p>'
|
|
149
|
-
'<span style="text-decoration: underline line-through;">lorem</span>'
|
|
150
|
-
'<span style="text-decoration: underline;"> ipsum</span>'
|
|
151
|
-
|
|
148
|
+
const output = '<p>'
|
|
149
|
+
+ '<span style="text-decoration: underline line-through;">lorem</span>'
|
|
150
|
+
+ '<span style="text-decoration: underline;"> ipsum</span>'
|
|
151
|
+
+ '</p>';
|
|
152
152
|
|
|
153
153
|
expect(ContentNormalizer.normalize(input)).toBe(output);
|
|
154
154
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zipify/wysiwyg",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.3",
|
|
4
4
|
"description": "Zipify modification of TipTap text editor",
|
|
5
5
|
"main": "dist/wysiwyg.mjs",
|
|
6
6
|
"types": "dist/wysiwyg.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"example:start": "NODE_ENV=development vite serve --config config/build/example.config.ts",
|
|
28
28
|
"example:build": "NODE_ENV=production vite build --config config/build/example.config.ts",
|
|
29
29
|
"test:unit": "jest .",
|
|
30
|
-
"lint:js": "
|
|
30
|
+
"lint:js": "zipify-lint-js --oxlint-tsconfig ./tsconfig.lint.json ./lib",
|
|
31
31
|
"lint:css": "stylelint ./lib/**/*.{css,vue}",
|
|
32
32
|
"optimize-svg": "svgo --config ./config/svgo.js",
|
|
33
33
|
"prepare": "husky"
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@babel/core": "^7.25.8",
|
|
69
|
-
"@babel/eslint-parser": "^7.25.8",
|
|
70
69
|
"@babel/plugin-transform-runtime": "^7.25.7",
|
|
71
70
|
"@babel/preset-env": "^7.25.8",
|
|
72
71
|
"@babel/runtime": "^7.25.7",
|
|
@@ -76,26 +75,17 @@
|
|
|
76
75
|
"@rollup/plugin-json": "^6.1.0",
|
|
77
76
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
78
77
|
"@rollup/plugin-replace": "^6.0.1",
|
|
79
|
-
"@rushstack/eslint-patch": "^1.10.4",
|
|
80
78
|
"@stylistic/stylelint-plugin": "^3.1.1",
|
|
81
79
|
"@types/jest": "^29.5.14",
|
|
82
80
|
"@types/node": "^22.9.0",
|
|
83
|
-
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
84
|
-
"@typescript-eslint/parser": "^7.18.0",
|
|
85
81
|
"@vitejs/plugin-vue": "^5.2.0",
|
|
86
|
-
"@vue/eslint-config-typescript": "^13.0.0",
|
|
87
82
|
"@vue/test-utils": "^2.4.6",
|
|
88
83
|
"@vue/tsconfig": "^0.5.1",
|
|
89
84
|
"@vue/vue3-jest": "^29.2.6",
|
|
90
85
|
"@zipify/colorpicker": "^4.1.1",
|
|
91
|
-
"@zipify/eslint-config": "^
|
|
86
|
+
"@zipify/eslint-config": "^3.0.0",
|
|
92
87
|
"babel-jest": "^29.7.0",
|
|
93
88
|
"esbuild-jest": "^0.5.0",
|
|
94
|
-
"eslint": "^8.57.1",
|
|
95
|
-
"eslint-import-resolver-alias": "^1.1.2",
|
|
96
|
-
"eslint-plugin-import": "^2.31.0",
|
|
97
|
-
"eslint-plugin-jest": "^27.9.0",
|
|
98
|
-
"eslint-plugin-vue": "^9.29.0",
|
|
99
89
|
"husky": "^9.1.6",
|
|
100
90
|
"jest": "^29.7.0",
|
|
101
91
|
"jest-environment-jsdom": "^29.7.0",
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
2
|
-
|
|
3
|
-
const appPackage = require('./package.json');
|
|
4
|
-
|
|
5
|
-
const jestVersion = appPackage.devDependencies.jest.replace('^', '');
|
|
6
|
-
const jestMajorVersion = Number(jestVersion.split('.')[0]);
|
|
7
|
-
|
|
8
|
-
const tsParserOptions = {
|
|
9
|
-
project: './tsconfig.json',
|
|
10
|
-
extraFileExtensions: ['.vue']
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
module.exports = {
|
|
14
|
-
root: true,
|
|
15
|
-
settings: {
|
|
16
|
-
'import/resolver': {
|
|
17
|
-
alias: {
|
|
18
|
-
map: {
|
|
19
|
-
'@': './lib'
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
node: {
|
|
23
|
-
extensions: [
|
|
24
|
-
'.js',
|
|
25
|
-
'.ts',
|
|
26
|
-
'.css',
|
|
27
|
-
'.vue',
|
|
28
|
-
'.html'
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
jest: {
|
|
33
|
-
version: jestMajorVersion
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
env: {
|
|
37
|
-
jest: true
|
|
38
|
-
},
|
|
39
|
-
globals: {
|
|
40
|
-
globalThis: true,
|
|
41
|
-
ZW_UPDATED_AT: true
|
|
42
|
-
},
|
|
43
|
-
overrides: [
|
|
44
|
-
{
|
|
45
|
-
files: '*.js',
|
|
46
|
-
extends: ['@zipify/eslint-config/preset-js']
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
files: '*.ts',
|
|
50
|
-
extends: ['@zipify/eslint-config/preset-ts']
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
files: '*.test.{js,ts}',
|
|
54
|
-
extends: ['@zipify/eslint-config/preset-jest']
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
files: '*.vue',
|
|
58
|
-
extends: ['@zipify/eslint-config/preset-vue3-ts'],
|
|
59
|
-
parserOptions: {
|
|
60
|
-
parser: '@typescript-eslint/parser',
|
|
61
|
-
parserOptions: tsParserOptions
|
|
62
|
-
},
|
|
63
|
-
rules: {
|
|
64
|
-
// Temporary disable rules for js to ts migration
|
|
65
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
66
|
-
'import/extensions': 'off'
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
files: '*.{js,ts,vue}',
|
|
71
|
-
parserOptions: tsParserOptions,
|
|
72
|
-
rules: {
|
|
73
|
-
'import/order': [
|
|
74
|
-
'error',
|
|
75
|
-
{
|
|
76
|
-
pathGroups: [
|
|
77
|
-
{
|
|
78
|
-
pattern: '@/**',
|
|
79
|
-
group: 'external',
|
|
80
|
-
position: 'after'
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
groups: [
|
|
84
|
-
'builtin',
|
|
85
|
-
'external',
|
|
86
|
-
'internal',
|
|
87
|
-
'parent',
|
|
88
|
-
'sibling'
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
};
|
package/.lintstagedrc
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"*.{vue,css}": [
|
|
3
|
-
"stylelint --allow-empty-input --fix --config stylelint.config.mjs"
|
|
4
|
-
],
|
|
5
|
-
"*.{vue,js}": [
|
|
6
|
-
"eslint --fix --fix-type layout --fix-type suggestion --config .eslintrc.js",
|
|
7
|
-
"jest --passWithNoTests --findRelatedTests"
|
|
8
|
-
],
|
|
9
|
-
"*.svg": [
|
|
10
|
-
"svgo --config ./config/svgo.js"
|
|
11
|
-
]
|
|
12
|
-
}
|