Skip to content

Commit adb8c7d

Browse files
authored
chore!: remove TSLint support (#5065)
closes #5064
1 parent 393e79b commit adb8c7d

File tree

21 files changed

+16
-564
lines changed

21 files changed

+16
-564
lines changed

docs/core-plugins/typescript.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ Since `3.0.0-rc.6`, `typescript` is now a peer dependency of this package, so yo
1212

1313
This plugin can be used alongside `@vue/cli-plugin-babel`. When used with Babel, this plugin will output ES2015 and delegate the rest to Babel for auto polyfill based on browser targets.
1414

15-
## Injected Commands
16-
17-
If opted to use [TSLint](https://palantir.github.io/tslint/) during project creation, `vue-cli-service lint` will be injected.
18-
1915
## Caching
2016

2117
[cache-loader](https://github.com/webpack-contrib/cache-loader) is enabled by default and cache is stored in `<projectRoot>/node_modules/.cache/ts-loader`.

docs/ru/core-plugins/typescript.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ TypeScript может быть сконфигурирован через `tsconf
1212

1313
Этот плагин может использоваться вместе с `@vue/cli-plugin-babel`. При использовании вместе с Babel, этот плагин должен генерировать ES2015 и делегировать остальное Babel для автоматического добавления полифилов на основе целевых браузеров.
1414

15-
## Внедряемые команды
16-
17-
При выборе [TSLint](https://palantir.github.io/tslint/) на этапе создания проекта, будет внедряться команда `vue-cli-service lint`.
18-
1915
## Кэширование
2016

2117
[cache-loader](https://github.com/webpack-contrib/cache-loader) используется по умолчанию, кэш хранится в `<projectRoot>/node_modules/.cache/ts-loader`.

packages/@vue/cli-plugin-e2e-cypress/__tests__/cypressPlugin.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ test('should work with TS', async () => {
3030
plugins: {
3131
'@vue/cli-plugin-typescript': {
3232
'classComponent': true,
33-
'tsLint': true,
3433
'lintOn': ['save']
3534
},
3635
'@vue/cli-plugin-e2e-cypress': {}

packages/@vue/cli-plugin-e2e-webdriverio/__tests__/wdioPlugin.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ test('should work with TS', async () => {
2828
plugins: {
2929
'@vue/cli-plugin-typescript': {
3030
'classComponent': true,
31-
'tsLint': true,
3231
'lintOn': ['save']
3332
},
3433
'@vue/cli-plugin-e2e-webdriverio': {

packages/@vue/cli-plugin-typescript/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ Since `3.0.0-rc.6`, `typescript` is now a peer dependency of this package, so yo
1212

1313
This plugin can be used alongside `@vue/cli-plugin-babel`. When used with Babel, this plugin will output ES2015 and delegate the rest to Babel for auto polyfill based on browser targets.
1414

15-
## Injected Commands
16-
17-
If opted to use [TSLint](https://palantir.github.io/tslint/) during project creation, `vue-cli-service lint` will be injected.
18-
1915
## Caching
2016

2117
[cache-loader](https://github.com/webpack-contrib/cache-loader) is enabled by default and cache is stored in `<projectRoot>/node_modules/.cache/ts-loader`.

packages/@vue/cli-plugin-typescript/__tests__/tsConvertLintFlags.spec.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/@vue/cli-plugin-typescript/__tests__/tsGenerator.spec.js

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -80,43 +80,6 @@ test('use with router', async () => {
8080
expect(files['src/views/Home.vue']).toMatch('<div class=\"home\">')
8181
})
8282

83-
test('lint', async () => {
84-
const { pkg, files } = await generateWithPlugin([
85-
{
86-
id: 'ts',
87-
apply: require('../generator'),
88-
options: {
89-
tsLint: true,
90-
lintOn: ['save', 'commit']
91-
}
92-
}
93-
])
94-
95-
expect(pkg.scripts.lint).toBe(`vue-cli-service lint`)
96-
expect(pkg.devDependencies).toHaveProperty('lint-staged')
97-
expect(pkg.gitHooks).toEqual({ 'pre-commit': 'lint-staged' })
98-
expect(pkg['lint-staged']).toEqual({
99-
'*.ts': ['vue-cli-service lint', 'git add'],
100-
'*.vue': ['vue-cli-service lint', 'git add']
101-
})
102-
103-
expect(files['tslint.json']).toBeTruthy()
104-
})
105-
106-
test('lint with no lintOnSave', async () => {
107-
const { pkg } = await generateWithPlugin([
108-
{
109-
id: 'ts',
110-
apply: require('../generator'),
111-
options: {
112-
tsLint: true,
113-
lintOn: ['commit']
114-
}
115-
}
116-
])
117-
expect(pkg.vue).toEqual({ lintOnSave: false })
118-
})
119-
12083
test('tsconfig.json should be valid json', async () => {
12184
const { files } = await generateWithPlugin([
12285
{

packages/@vue/cli-plugin-typescript/__tests__/tsPluginTSLint.spec.js

Lines changed: 0 additions & 115 deletions
This file was deleted.

packages/@vue/cli-plugin-typescript/generator/convert.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
module.exports = (api, { tsLint = false, convertJsToTs = true } = {}) => {
1+
module.exports = (api, { convertJsToTs = true } = {}) => {
22
const jsRE = /\.js$/
33
let excludeRE = /^tests\/e2e\/|(\.config|rc)\.js$/
44

55
if (api.hasPlugin('e2e-webdriverio')) {
66
excludeRE = /(\.config|rc)\.js$/
77
}
8-
const convertLintFlags = require('../lib/convertLintFlags')
9-
api.postProcessFiles(files => {
8+
api.postProcessFiles((files) => {
109
if (convertJsToTs) {
1110
// delete all js files that have a ts file of the same name
1211
// and simply rename other js files to ts
1312
for (const file in files) {
1413
if (jsRE.test(file) && !excludeRE.test(file)) {
1514
const tsFile = file.replace(jsRE, '.ts')
1615
if (!files[tsFile]) {
17-
let content = files[file]
18-
if (tsLint) {
19-
content = convertLintFlags(content)
20-
}
16+
const content = files[file]
2117
files[tsFile] = content
2218
}
2319
delete files[file]
@@ -26,10 +22,7 @@ module.exports = (api, { tsLint = false, convertJsToTs = true } = {}) => {
2622
} else {
2723
// rename only main file to main.ts
2824
const tsFile = api.entryFile.replace(jsRE, '.ts')
29-
let content = files[api.entryFile]
30-
if (tsLint) {
31-
content = convertLintFlags(content)
32-
}
25+
const content = files[api.entryFile]
3326
files[tsFile] = content
3427
delete files[api.entryFile]
3528
}

packages/@vue/cli-plugin-typescript/generator/index.js

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
const pluginDevDeps = require('../package.json').devDependencies
22

3-
module.exports = (api, {
4-
classComponent,
5-
tsLint,
6-
lintOn = [],
7-
skipLibCheck = true,
8-
convertJsToTs,
9-
allowJs
10-
}, rootOptions, invoking) => {
11-
if (typeof lintOn === 'string') {
12-
lintOn = lintOn.split(',')
13-
}
3+
module.exports = (
4+
api,
5+
{ classComponent, skipLibCheck = true, convertJsToTs, allowJs },
6+
rootOptions,
7+
invoking
8+
) => {
149
const isVue3 = rootOptions && rootOptions.vueVersion === '3'
1510

1611
api.extendPackage({
@@ -36,42 +31,6 @@ module.exports = (api, {
3631
}
3732
}
3833

39-
if (tsLint) {
40-
api.extendPackage({
41-
scripts: {
42-
lint: 'vue-cli-service lint'
43-
}
44-
})
45-
46-
if (!lintOn.includes('save')) {
47-
api.extendPackage({
48-
vue: {
49-
lintOnSave: false
50-
}
51-
})
52-
}
53-
54-
if (lintOn.includes('commit')) {
55-
api.extendPackage({
56-
devDependencies: {
57-
'lint-staged': '^9.5.0'
58-
},
59-
gitHooks: {
60-
'pre-commit': 'lint-staged'
61-
},
62-
'lint-staged': {
63-
'*.ts': ['vue-cli-service lint', 'git add'],
64-
'*.vue': ['vue-cli-service lint', 'git add']
65-
}
66-
})
67-
}
68-
69-
// lint and fix files on creation complete
70-
api.onCreateComplete(() => {
71-
return require('../lib/tslint')({}, api, true)
72-
})
73-
}
74-
7534
// late invoke compat
7635
if (invoking) {
7736
if (api.hasPlugin('unit-mocha')) {
@@ -110,5 +69,5 @@ module.exports = (api, {
11069
api.render((files) => delete files['src/shims-tsx.d.ts'])
11170
}
11271

113-
require('./convert')(api, { tsLint, convertJsToTs })
72+
require('./convert')(api, { convertJsToTs })
11473
}

packages/@vue/cli-plugin-typescript/generator/template/src/shims-tsx.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import Vue, { VNode } from 'vue'
22

33
declare global {
44
namespace JSX {
5-
// tslint:disable no-empty-interface
65
interface Element extends VNode {}
7-
// tslint:disable no-empty-interface
86
interface ElementClass extends Vue {}
97
interface IntrinsicElements {
108
[elem: string]: any

packages/@vue/cli-plugin-typescript/generator/template/tslint.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)