Buckets:
Sleepyfx/my-trading-vscode / vscode /code-server /extensions /ms-python.python-2026.4.0-universal /.eslintplugin /no-bad-gdpr-comment.ts
| /*--------------------------------------------------------------------------------------------- | |
| * Copyright (c) Microsoft Corporation. All rights reserved. | |
| * Licensed under the MIT License. See License.txt in the project root for license information. | |
| *--------------------------------------------------------------------------------------------*/ | |
| import * as eslint from 'eslint'; | |
| const noBadGDPRComment: eslint.Rule.RuleModule = { | |
| create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { | |
| return { | |
| ['Program'](node) { | |
| for (const comment of (node as eslint.AST.Program).comments) { | |
| if (comment.type !== 'Block' || !comment.loc) { | |
| continue; | |
| } | |
| if (!comment.value.includes('__GDPR__')) { | |
| continue; | |
| } | |
| const dataStart = comment.value.indexOf('\n'); | |
| const data = comment.value.substring(dataStart); | |
| let gdprData: { [key: string]: object } | undefined; | |
| try { | |
| const jsonRaw = `{ ${data} }`; | |
| gdprData = JSON.parse(jsonRaw); | |
| } catch (e) { | |
| context.report({ | |
| loc: { start: comment.loc.start, end: comment.loc.end }, | |
| message: 'GDPR comment is not valid JSON', | |
| }); | |
| } | |
| if (gdprData) { | |
| const len = Object.keys(gdprData).length; | |
| if (len !== 1) { | |
| context.report({ | |
| loc: { start: comment.loc.start, end: comment.loc.end }, | |
| message: `GDPR comment must contain exactly one key, not ${Object.keys(gdprData).join( | |
| ', ', | |
| )}`, | |
| }); | |
| } | |
| } | |
| } | |
| }, | |
| }; | |
| }, | |
| }; | |
| module.exports = { | |
| rules: { | |
| 'no-bad-gdpr-comment': noBadGDPRComment, // Ensure correct structure | |
| }, | |
| }; | |
Xet Storage Details
- Size:
- 2.24 kB
- Xet hash:
- 96672961c5b99ce0ba2529e7a9e8c7e665c6cd01c6431f0dc1b6b61682209362
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.