Skip to content

Commit 5b21c7f

Browse files
authored
Run our custom eslint rules using ts-node (microsoft#157532)
* Run our custom eslint rules using ts-node Use `ts-node` to run our custom eslint rules. This lets us delete the pre-compiled js. It also means you can don't have to compile the rules while editing them As part of this change, I've also switched us to using an eslint plugin instead of a rulesDir. This is now the preferred way to ship custom rules * Fix two more disables * Move ts-node to project root * Enable transpileOnly
1 parent 07025f0 commit 5b21c7f

File tree

58 files changed

+154
-1122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+154
-1122
lines changed

.eslintrc.json

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"plugins": [
99
"@typescript-eslint",
1010
"jsdoc",
11-
"header"
11+
"header",
12+
"@vscode"
1213
],
1314
"rules": {
1415
"constructor-super": "warn",
@@ -61,17 +62,17 @@
6162
]
6263
}
6364
],
64-
"code-no-unused-expressions": [
65+
"@vscode/code-no-unused-expressions": [
6566
"warn",
6667
{
6768
"allowTernary": true
6869
}
6970
],
70-
"code-translation-remind": "warn",
71-
"code-no-nls-in-standalone-editor": "warn",
72-
"code-no-standalone-editor": "warn",
73-
"code-no-unexternalized-strings": "warn",
74-
"code-layering": [
71+
"@vscode/code-translation-remind": "warn",
72+
"@vscode/code-no-nls-in-standalone-editor": "warn",
73+
"@vscode/code-no-standalone-editor": "warn",
74+
"@vscode/code-no-unexternalized-strings": "warn",
75+
"@vscode/code-layering": [
7576
"warn",
7677
{
7778
"common": [],
@@ -122,8 +123,8 @@
122123
"**/*.test.ts"
123124
],
124125
"rules": {
125-
"code-no-test-only": "error",
126-
"code-no-unexternalized-strings": "off"
126+
"@vscode/code-no-test-only": "error",
127+
"@vscode/code-no-unexternalized-strings": "off"
127128
}
128129
},
129130
{
@@ -132,14 +133,14 @@
132133
"**/vscode.proposed.*.d.ts"
133134
],
134135
"rules": {
135-
"vscode-dts-create-func": "warn",
136-
"vscode-dts-literal-or-types": "warn",
137-
"vscode-dts-interface-naming": "warn",
138-
"vscode-dts-cancellation": "warn",
139-
"vscode-dts-use-thenable": "warn",
140-
"vscode-dts-region-comments": "warn",
141-
"vscode-dts-vscode-in-comments": "warn",
142-
"vscode-dts-provider-naming": [
136+
"@vscode/vscode-dts-create-func": "warn",
137+
"@vscode/vscode-dts-literal-or-types": "warn",
138+
"@vscode/vscode-dts-interface-naming": "warn",
139+
"@vscode/vscode-dts-cancellation": "warn",
140+
"@vscode/vscode-dts-use-thenable": "warn",
141+
"@vscode/vscode-dts-region-comments": "warn",
142+
"@vscode/vscode-dts-vscode-in-comments": "warn",
143+
"@vscode/vscode-dts-provider-naming": [
143144
"warn",
144145
{
145146
"allowed": [
@@ -154,7 +155,7 @@
154155
]
155156
}
156157
],
157-
"vscode-dts-event-naming": [
158+
"@vscode/vscode-dts-event-naming": [
158159
"warn",
159160
{
160161
"allowed": [
@@ -200,8 +201,8 @@
200201
"src/**/*.ts"
201202
],
202203
"rules": {
203-
"code-no-look-behind-regex": "warn",
204-
"code-import-patterns": [
204+
"@vscode/code-no-look-behind-regex": "warn",
205+
"@vscode/code-import-patterns": [
205206
"warn",
206207
{
207208
// imports that are allowed in all files of layers:
@@ -576,7 +577,7 @@
576577
"test/**/*.ts"
577578
],
578579
"rules": {
579-
"code-import-patterns": [
580+
"@vscode/code-import-patterns": [
580581
"warn",
581582
{
582583
"target": "test/smoke/**",

.vscode/settings.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@
4141
}
4242
}
4343
],
44-
"eslint.options": {
45-
"rulePaths": [
46-
"./build/lib/eslint"
47-
]
48-
},
4944
"typescript.tsdk": "node_modules/typescript/lib",
5045
"npm.exclude": "**/extensions/**",
5146
"npm.packageManager": "yarn",

build/eslint.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ function eslint() {
1313
.src(eslintFilter, { base: '.', follow: true, allowEmpty: true })
1414
.pipe(
1515
gulpeslint({
16-
configFile: '.eslintrc.json',
17-
rulePaths: ['./build/lib/eslint'],
16+
configFile: '.eslintrc.json'
1817
})
1918
)
2019
.pipe(gulpeslint.formatEach('compact'))

build/hygiene.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ function hygiene(some, linting = true) {
173173
.pipe(filter(eslintFilter))
174174
.pipe(
175175
gulpeslint({
176-
configFile: '.eslintrc.json',
177-
rulePaths: ['./build/lib/eslint'],
176+
configFile: '.eslintrc.json'
178177
})
179178
)
180179
.pipe(gulpeslint.formatEach('compact'))

build/lib/eslint/code-import-patterns.ts renamed to build/lib/eslint-plugin-vscode/code-import-patterns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as eslint from 'eslint';
77
import { TSESTree } from '@typescript-eslint/experimental-utils';
88
import * as path from 'path';
9-
import * as minimatch from 'minimatch';
9+
import minimatch from 'minimatch';
1010
import { createImportRuleListener } from './utils';
1111

1212
const REPO_ROOT = path.normalize(path.join(__dirname, '../../../'));

0 commit comments

Comments
 (0)