Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/filters.ts
4770 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { readFileSync } from 'fs';
7
import { join } from 'path';
8
9
/**
10
* Hygiene works by creating cascading subsets of all our files and
11
* passing them through a sequence of checks. Here are the current subsets,
12
* named according to the checks performed on them. Each subset contains
13
* the following one, as described in mathematical notation:
14
*
15
* all ⊃ eol ⊇ indentation ⊃ copyright ⊃ typescript
16
*/
17
18
export const all = Object.freeze<string[]>([
19
'*',
20
'build/**/*',
21
'extensions/**/*',
22
'scripts/**/*',
23
'src/**/*',
24
'test/**/*',
25
'!cli/**/*',
26
'!out*/**',
27
'!extensions/**/out*/**',
28
'!test/**/out/**',
29
'!**/node_modules/**',
30
'!**/*.js.map',
31
]);
32
33
export const unicodeFilter = Object.freeze<string[]>([
34
'**',
35
36
'!**/ThirdPartyNotices.txt',
37
'!**/ThirdPartyNotices.cli.txt',
38
'!**/LICENSE.{txt,rtf}',
39
'!LICENSES.chromium.html',
40
'!**/LICENSE',
41
42
'!**/*.{dll,exe,png,bmp,jpg,scpt,cur,ttf,woff,eot,template,ico,icns,opus,wasm}',
43
'!**/test/**',
44
'!**/*.test.ts',
45
'!**/*.{d.ts,json,md}',
46
'!**/*.mp3',
47
48
'!build/win32/**',
49
'!extensions/markdown-language-features/notebook-out/*.js',
50
'!extensions/markdown-math/notebook-out/**',
51
'!extensions/mermaid-chat-features/chat-webview-out/**',
52
'!extensions/ipynb/notebook-out/**',
53
'!extensions/notebook-renderers/renderer-out/**',
54
'!extensions/php-language-features/src/features/phpGlobalFunctions.ts',
55
'!extensions/terminal-suggest/src/completions/upstream/**',
56
'!extensions/typescript-language-features/test-workspace/**',
57
'!extensions/vscode-api-tests/testWorkspace/**',
58
'!extensions/vscode-api-tests/testWorkspace2/**',
59
'!extensions/**/dist/**',
60
'!extensions/**/out/**',
61
'!extensions/**/snippets/**',
62
'!extensions/**/colorize-fixtures/**',
63
'!extensions/terminal-suggest/src/shell/fishBuiltinsCache.ts',
64
65
'!src/vs/base/browser/dompurify/**',
66
'!src/vs/workbench/services/keybinding/browser/keyboardLayouts/**',
67
'!src/vs/workbench/contrib/terminal/common/scripts/psreadline/**',
68
]);
69
70
export const indentationFilter = Object.freeze<string[]>([
71
'**',
72
73
// except specific files
74
'!**/ThirdPartyNotices.txt',
75
'!**/ThirdPartyNotices.cli.txt',
76
'!**/LICENSE.{txt,rtf}',
77
'!LICENSES.chromium.html',
78
'!**/LICENSE',
79
'!**/*.mp3',
80
'!src/vs/base/browser/dompurify/*',
81
'!src/vs/base/common/marked/marked.js',
82
'!src/vs/base/common/semver/semver.js',
83
'!src/vs/base/node/terminateProcess.sh',
84
'!src/vs/base/node/cpuUsage.sh',
85
'!src/vs/editor/common/languages/highlights/*.scm',
86
'!src/vs/editor/common/languages/injections/*.scm',
87
'!test/unit/assert.js',
88
'!resources/linux/snap/electron-launch',
89
'!build/ext.js',
90
'!build/npm/gyp/patches/gyp_spectre_mitigation_support.patch',
91
'!product.overrides.json',
92
93
// except specific folders
94
'!test/automation/out/**',
95
'!test/monaco/out/**',
96
'!test/smoke/out/**',
97
'!extensions/terminal-suggest/src/shell/zshBuiltinsCache.ts',
98
'!extensions/terminal-suggest/src/shell/fishBuiltinsCache.ts',
99
'!extensions/terminal-suggest/src/completions/upstream/**',
100
'!extensions/typescript-language-features/test-workspace/**',
101
'!extensions/typescript-language-features/resources/walkthroughs/**',
102
'!extensions/typescript-language-features/package-manager/node-maintainer/**',
103
'!extensions/markdown-math/notebook-out/**',
104
'!extensions/ipynb/notebook-out/**',
105
'!extensions/vscode-api-tests/testWorkspace/**',
106
'!extensions/vscode-api-tests/testWorkspace2/**',
107
'!build/monaco/**',
108
'!build/win32/**',
109
'!build/checker/**',
110
'!src/vs/workbench/contrib/terminal/common/scripts/psreadline/**',
111
112
// except multiple specific files
113
'!**/package.json',
114
'!**/package-lock.json',
115
116
// except multiple specific folders
117
'!**/codicon/**',
118
'!**/fixtures/**',
119
'!**/lib/**',
120
'!extensions/**/dist/**',
121
'!extensions/**/out/**',
122
'!extensions/**/snippets/**',
123
'!extensions/**/syntaxes/**',
124
'!extensions/**/themes/**',
125
'!extensions/**/colorize-fixtures/**',
126
127
// except specific file types
128
'!src/vs/*/**/*.d.ts',
129
'!src/typings/**/*.d.ts',
130
'!extensions/**/*.d.ts',
131
'!**/*.{svg,exe,png,bmp,jpg,scpt,bat,cmd,cur,ttf,woff,eot,md,ps1,psm1,template,yaml,yml,d.ts.recipe,ico,icns,plist,opus,admx,adml,wasm}',
132
'!build/{lib,download,linux,darwin}/**/*.js',
133
'!build/**/*.sh',
134
'!build/azure-pipelines/**/*.js',
135
'!build/azure-pipelines/**/*.config',
136
'!build/npm/gyp/custom-headers/*.patch',
137
'!**/Dockerfile',
138
'!**/Dockerfile.*',
139
'!**/*.Dockerfile',
140
'!**/*.dockerfile',
141
142
// except for built files
143
'!extensions/mermaid-chat-features/chat-webview-out/*.js',
144
'!extensions/markdown-language-features/media/*.js',
145
'!extensions/markdown-language-features/notebook-out/*.js',
146
'!extensions/markdown-math/notebook-out/*.js',
147
'!extensions/ipynb/notebook-out/**',
148
'!extensions/notebook-renderers/renderer-out/*.js',
149
'!extensions/simple-browser/media/*.js',
150
]);
151
152
export const copyrightFilter = Object.freeze<string[]>([
153
'**',
154
'!**/*.desktop',
155
'!**/*.json',
156
'!**/*.html',
157
'!**/*.template',
158
'!**/*.md',
159
'!**/*.bat',
160
'!**/*.cmd',
161
'!**/*.ico',
162
'!**/*.opus',
163
'!**/*.mp3',
164
'!**/*.icns',
165
'!**/*.xml',
166
'!**/*.sh',
167
'!**/*.zsh',
168
'!**/*.fish',
169
'!**/*.txt',
170
'!**/*.xpm',
171
'!**/*.opts',
172
'!**/*.disabled',
173
'!**/*.code-workspace',
174
'!**/*.js.map',
175
'!**/*.wasm',
176
'!build/**/*.init',
177
'!build/linux/libcxx-fetcher.*',
178
'!build/npm/gyp/custom-headers/*.patch',
179
'!resources/linux/snap/snapcraft.yaml',
180
'!resources/win32/bin/code.js',
181
'!resources/completions/**',
182
'!extensions/configuration-editing/build/inline-allOf.ts',
183
'!extensions/markdown-language-features/media/highlight.css',
184
'!extensions/markdown-math/notebook-out/**',
185
'!extensions/ipynb/notebook-out/**',
186
'!extensions/simple-browser/media/codicon.css',
187
'!extensions/terminal-suggest/src/completions/upstream/**',
188
'!extensions/typescript-language-features/node-maintainer/**',
189
'!extensions/html-language-features/server/src/modes/typescript/*',
190
'!extensions/*/server/bin/*',
191
'!src/vs/workbench/contrib/terminal/common/scripts/psreadline/**',
192
]);
193
194
export const tsFormattingFilter = Object.freeze<string[]>([
195
'src/**/*.ts',
196
'test/**/*.ts',
197
'extensions/**/*.ts',
198
'!src/vs/*/**/*.d.ts',
199
'!src/typings/**/*.d.ts',
200
'!extensions/**/*.d.ts',
201
'!**/fixtures/**',
202
'!**/typings/**',
203
'!**/node_modules/**',
204
'!extensions/**/colorize-fixtures/**',
205
'!extensions/vscode-api-tests/testWorkspace/**',
206
'!extensions/vscode-api-tests/testWorkspace2/**',
207
'!extensions/**/*.test.ts',
208
'!extensions/html-language-features/server/lib/jquery.d.ts',
209
'!extensions/terminal-suggest/src/shell/zshBuiltinsCache.ts',
210
'!extensions/terminal-suggest/src/shell/fishBuiltinsCache.ts',
211
]);
212
213
export const eslintFilter = Object.freeze<string[]>([
214
'**/*.js',
215
'**/*.cjs',
216
'**/*.mjs',
217
'**/*.ts',
218
'.eslint-plugin-local/**/*.ts',
219
...readFileSync(join(import.meta.dirname, '..', '.eslint-ignore'))
220
.toString()
221
.split(/\r\n|\n/)
222
.filter(line => line && !line.startsWith('#'))
223
.map(line => line.startsWith('!') ? line.slice(1) : `!${line}`)
224
]);
225
226
export const stylelintFilter = Object.freeze<string[]>([
227
'src/**/*.css'
228
]);
229
230