Visual studio code TSLint内联规则在VS代码中停止工作
我的工作中有一个setup VS Code+TSLint扩展,它工作得非常好。 不,我在家工作,做了相同的设置,但发现内联规则在家中停止工作设置,例如TS Lint说我应该为Visual studio code TSLint内联规则在VS代码中停止工作,visual-studio-code,rules,ignore,tslint,Visual Studio Code,Rules,Ignore,Tslint,我的工作中有一个setup VS Code+TSLint扩展,它工作得非常好。 不,我在家工作,做了相同的设置,但发现内联规则在家中停止工作设置,例如TS Lint说我应该为使用self-closed标记,我想忽略它并添加//tslint:disable next line:jsx self-close,但正如您在屏幕截图上看到的,带下划线的警告仍然存在: 这也适用于任何其他内联规则。 因为我在vs codesettings.json中有“source.fixAll.tslint”:true,
使用self-closed标记,我想忽略它并添加//tslint:disable next line:jsx self-close
,但正如您在屏幕截图上看到的,带下划线的警告仍然存在:
这也适用于任何其他内联规则。
因为我在vs codesettings.json中有“source.fixAll.tslint”:true
,所以它总是以我不想要的方式修复它。
我试着在谷歌上搜索,但找不到类似的问题
这里还有我的tsconfig.json
文件:
{
"compilerOptions": {
"noEmit": false,
"sourceMap": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strict": false,
"module": "commonjs",
"allowJs": true,
"target": "esnext",
"esModuleInterop": true,
"jsx": "react",
"typeRoots": [
"./src/typings",
"./node_modules/@types"
]
},
"include": [
"./src/**/*"
],
"exclude": [
"node_modules",
"./src/public"
]
}
注释的位置错误,正确的位置是:
// tslint:disable: jsx-self-close
export const AmpAnalytics = React.memo(() => (
<amp-analytics type="googleanalytics">
<script
type="application/json"
dangerouslySetInnerHTML={{ __html: json }}
>
</script>
</amp-analytics>
));
//tslint:disable:jsx self-close
export const AmpAnalytics=React.memo(()=>(
));