Skip to content

Commit 50d5e85

Browse files
committed
style: enable trailingComma in prettier
I think we don't have to strictly conform to the styles from vuejs/core, so let's choose a style that better suited for this project.
1 parent dd60a39 commit 50d5e85

30 files changed

+203
-191
lines changed

.prettierrc

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
22
"semi": false,
3-
"tabWidth": 2,
43
"singleQuote": true,
5-
"printWidth": 100,
6-
"trailingComma": "none"
4+
"printWidth": 100
75
}

__test__/renderEslint.spec.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('renderEslint', () => {
77
needsVitest: false,
88
needsCypress: false,
99
needsCypressCT: false,
10-
needsPlaywright: false
10+
needsPlaywright: false,
1111
})
1212
expect(additionalConfigs).toStrictEqual([])
1313
})
@@ -17,7 +17,7 @@ describe('renderEslint', () => {
1717
needsVitest: true,
1818
needsCypress: false,
1919
needsCypressCT: false,
20-
needsPlaywright: false
20+
needsPlaywright: false,
2121
})
2222
expect(additionalConfigs).toHaveLength(1)
2323
const [additionalVitestConfig] = additionalConfigs
@@ -34,19 +34,19 @@ describe('renderEslint', () => {
3434
needsVitest: false,
3535
needsCypress: true,
3636
needsCypressCT: false,
37-
needsPlaywright: false
37+
needsPlaywright: false,
3838
})
3939
expect(additionalConfigs).toHaveLength(1)
4040
const [additionalCypressConfig] = additionalConfigs
4141
expect(additionalCypressConfig.devDependencies['eslint-plugin-cypress']).not.toBeUndefined()
4242
expect(additionalCypressConfig.afterVuePlugin).toHaveLength(1)
4343
const [additionalCypressPlugin] = additionalCypressConfig.afterVuePlugin!
4444
expect(additionalCypressPlugin.importer).toBe(
45-
"import pluginCypress from 'eslint-plugin-cypress/flat'"
45+
"import pluginCypress from 'eslint-plugin-cypress/flat'",
4646
)
4747
expect(additionalCypressPlugin.content).toContain('...pluginCypress.configs.recommended')
4848
expect(additionalCypressPlugin.content).toContain(
49-
"'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'"
49+
"'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'",
5050
)
5151
expect(additionalCypressPlugin.content).toContain("'cypress/support/**/*.{js,ts,jsx,tsx}'")
5252
})
@@ -56,20 +56,20 @@ describe('renderEslint', () => {
5656
needsVitest: false,
5757
needsCypress: true,
5858
needsCypressCT: true,
59-
needsPlaywright: false
59+
needsPlaywright: false,
6060
})
6161
expect(additionalConfigs).toHaveLength(1)
6262
const [additionalCypressConfig] = additionalConfigs
6363
expect(additionalCypressConfig.devDependencies['eslint-plugin-cypress']).not.toBeUndefined()
6464
expect(additionalCypressConfig.afterVuePlugin).toHaveLength(1)
6565
const [additionalCypressPlugin] = additionalCypressConfig.afterVuePlugin!
6666
expect(additionalCypressPlugin.importer).toBe(
67-
"import pluginCypress from 'eslint-plugin-cypress/flat'"
67+
"import pluginCypress from 'eslint-plugin-cypress/flat'",
6868
)
6969
expect(additionalCypressPlugin.content).toContain('...pluginCypress.configs.recommended')
7070
expect(additionalCypressPlugin.content).toContain("'**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}'")
7171
expect(additionalCypressPlugin.content).toContain(
72-
"'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'"
72+
"'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'",
7373
)
7474
expect(additionalCypressPlugin.content).toContain("'cypress/support/**/*.{js,ts,jsx,tsx}'")
7575
})
@@ -79,23 +79,23 @@ describe('renderEslint', () => {
7979
needsVitest: false,
8080
needsCypress: false,
8181
needsCypressCT: false,
82-
needsPlaywright: true
82+
needsPlaywright: true,
8383
})
8484
expect(additionalConfigs).toHaveLength(1)
8585
const [additionalPlaywrightConfig] = additionalConfigs
8686
expect(
87-
additionalPlaywrightConfig.devDependencies['eslint-plugin-playwright']
87+
additionalPlaywrightConfig.devDependencies['eslint-plugin-playwright'],
8888
).not.toBeUndefined()
8989
expect(additionalPlaywrightConfig.afterVuePlugin).toHaveLength(1)
9090
const [additionalPlaywrightPlugin] = additionalPlaywrightConfig.afterVuePlugin!
9191
expect(additionalPlaywrightPlugin.importer).toBe(
92-
"import pluginPlaywright from 'eslint-plugin-playwright'"
92+
"import pluginPlaywright from 'eslint-plugin-playwright'",
9393
)
9494
expect(additionalPlaywrightPlugin.content).toContain(
95-
"...pluginPlaywright.configs['flat/recommended']"
95+
"...pluginPlaywright.configs['flat/recommended']",
9696
)
9797
expect(additionalPlaywrightPlugin.content).toContain(
98-
"files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}']"
98+
"files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}']",
9999
)
100100
})
101101
})

__test__/sortDependencies.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('sortDependencies', () => {
77
dependencies: {
88
vue: '^3.3.4',
99
'vue-router': '^4.2.5',
10-
pinia: '^2.1.7'
10+
pinia: '^2.1.7',
1111
},
1212
devDependencies: {
1313
'@vitejs/plugin-vue-jsx': '^3.0.2',
@@ -20,14 +20,14 @@ describe('sortDependencies', () => {
2020
'@vitejs/plugin-vue': '^4.4.0',
2121
'eslint-plugin-cypress': '^2.15.1',
2222
'eslint-plugin-vue': '^9.17.0',
23-
vitest: '^0.34.6'
24-
}
23+
vitest: '^0.34.6',
24+
},
2525
}
2626
expect(sortDependencies(packageJson)).toStrictEqual({
2727
dependencies: {
2828
pinia: '^2.1.7',
2929
vue: '^3.3.4',
30-
'vue-router': '^4.2.5'
30+
'vue-router': '^4.2.5',
3131
},
3232
devDependencies: {
3333
'@vitejs/plugin-vue': '^4.4.0',
@@ -40,8 +40,8 @@ describe('sortDependencies', () => {
4040
jsdom: '^22.1.0',
4141
'start-server-and-test': '^2.0.1',
4242
vite: '^4.4.11',
43-
vitest: '^0.34.6'
44-
}
43+
vitest: '^0.34.6',
44+
},
4545
})
4646
})
4747
})

0 commit comments

Comments
 (0)