Skip to content

Commit 4ced550

Browse files
author
Christopher Quadflieg
committed
chore: remove tslint specific code
1 parent c72e0ca commit 4ced550

File tree

13 files changed

+8
-423
lines changed

13 files changed

+8
-423
lines changed

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-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: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,11 @@ test('use with router', async () => {
8181
})
8282

8383
test('lint', async () => {
84-
const { pkg, files } = await generateWithPlugin([
84+
const { pkg } = await generateWithPlugin([
8585
{
8686
id: 'ts',
8787
apply: require('../generator'),
8888
options: {
89-
tsLint: true,
9089
lintOn: ['save', 'commit']
9190
}
9291
}
@@ -99,8 +98,6 @@ test('lint', async () => {
9998
'*.ts': ['vue-cli-service lint', 'git add'],
10099
'*.vue': ['vue-cli-service lint', 'git add']
101100
})
102-
103-
expect(files['tslint.json']).toBeTruthy()
104101
})
105102

106103
test('lint with no lintOnSave', async () => {
@@ -109,7 +106,6 @@ test('lint with no lintOnSave', async () => {
109106
id: 'ts',
110107
apply: require('../generator'),
111108
options: {
112-
tsLint: true,
113109
lintOn: ['commit']
114110
}
115111
}

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: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
module.exports = (api, { tsLint = false, convertJsToTs = true } = {}) => {
1+
module.exports = (api, { convertJsToTs = true } = {}) => {
22
const jsRE = /\.js$/
33
const excludeRE = /^tests\/e2e\/|(\.config|rc)\.js$/
4-
const convertLintFlags = require('../lib/convertLintFlags')
54
api.postProcessFiles(files => {
65
if (convertJsToTs) {
76
// delete all js files that have a ts file of the same name
@@ -10,10 +9,7 @@ module.exports = (api, { tsLint = false, convertJsToTs = true } = {}) => {
109
if (jsRE.test(file) && !excludeRE.test(file)) {
1110
const tsFile = file.replace(jsRE, '.ts')
1211
if (!files[tsFile]) {
13-
let content = files[file]
14-
if (tsLint) {
15-
content = convertLintFlags(content)
16-
}
12+
const content = files[file]
1713
files[tsFile] = content
1814
}
1915
delete files[file]
@@ -22,10 +18,7 @@ module.exports = (api, { tsLint = false, convertJsToTs = true } = {}) => {
2218
} else {
2319
// rename only main file to main.ts
2420
const tsFile = api.entryFile.replace(jsRE, '.ts')
25-
let content = files[api.entryFile]
26-
if (tsLint) {
27-
content = convertLintFlags(content)
28-
}
21+
const content = files[api.entryFile]
2922
files[tsFile] = content
3023
delete files[api.entryFile]
3124
}
Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module.exports = (api, {
22
classComponent,
3-
tsLint,
43
lintOn = [],
54
convertJsToTs,
65
allowJs
@@ -24,42 +23,6 @@ module.exports = (api, {
2423
})
2524
}
2625

27-
if (tsLint) {
28-
api.extendPackage({
29-
scripts: {
30-
lint: 'vue-cli-service lint'
31-
}
32-
})
33-
34-
if (!lintOn.includes('save')) {
35-
api.extendPackage({
36-
vue: {
37-
lintOnSave: false
38-
}
39-
})
40-
}
41-
42-
if (lintOn.includes('commit')) {
43-
api.extendPackage({
44-
devDependencies: {
45-
'lint-staged': '^9.5.0'
46-
},
47-
gitHooks: {
48-
'pre-commit': 'lint-staged'
49-
},
50-
'lint-staged': {
51-
'*.ts': ['vue-cli-service lint', 'git add'],
52-
'*.vue': ['vue-cli-service lint', 'git add']
53-
}
54-
})
55-
}
56-
57-
// lint and fix files on creation complete
58-
api.onCreateComplete(() => {
59-
return require('../lib/tslint')({}, api, true)
60-
})
61-
}
62-
6326
// late invoke compat
6427
if (invoking) {
6528
if (api.hasPlugin('unit-mocha')) {
@@ -84,5 +47,5 @@ module.exports = (api, {
8447
hasJest: api.hasPlugin('unit-jest')
8548
})
8649

87-
require('./convert')(api, { tsLint, convertJsToTs })
50+
require('./convert')(api, { convertJsToTs })
8851
}

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.

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const path = require('path')
22

33
module.exports = (api, projectOptions) => {
4-
const fs = require('fs')
54
const useThreads = process.env.NODE_ENV === 'production' && !!projectOptions.parallel
65

76
api.chainWebpack(config => {
@@ -83,26 +82,10 @@ module.exports = (api, projectOptions) => {
8382
.plugin('fork-ts-checker')
8483
.use(require('fork-ts-checker-webpack-plugin'), [{
8584
vue: true,
86-
tslint: projectOptions.lintOnSave !== false && fs.existsSync(api.resolve('tslint.json')),
8785
formatter: 'codeframe',
8886
// https://github.com/TypeStrong/ts-loader#happypackmode-boolean-defaultfalse
8987
checkSyntacticErrors: useThreads
9088
}])
9189
}
9290
})
93-
94-
if (!api.hasPlugin('eslint')) {
95-
api.registerCommand('lint', {
96-
description: 'lint source files with TSLint',
97-
usage: 'vue-cli-service lint [options] [...files]',
98-
options: {
99-
'--format [formatter]': 'specify formatter (default: codeFrame)',
100-
'--no-fix': 'do not fix errors',
101-
'--formatters-dir [dir]': 'formatter directory',
102-
'--rules-dir [dir]': 'rules directory'
103-
}
104-
}, args => {
105-
return require('./lib/tslint')(args, api)
106-
})
107-
}
10891
}

packages/@vue/cli-plugin-typescript/lib/convertLintFlags.js

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

0 commit comments

Comments
 (0)