Disabling a TSLint rule makes VS Code shut up about it, but still blocks build #367
Description
Is this a bug report?
Yep.
Can you also reproduce the problem with npm 4.x?
Not applicable.
Which terms did you search for in User Guide?
tslint
, but this guide is from the JS CRA, which doesn't apply to TS issues…
Environment
npm ls react-scripts-ts
react-scripts-ts@2.16.0node -v
: v8.9.3npm -v
: 5.5.1yarn --version
1.7.0npm ls react-scripts-ts
Why is this here twice?
Then, specify:
- Operating system: Windows
- Browser and version (if relevant): irrelevant
Steps to Reproduce
Scaffold a project using this tool, then go to App.tsx
and type in this:
type AppProps = {};
type AppState = {};
and change React.Component
to React.Component<AppProps, AppState>
.
VS Code's TSLint extension (if installed) will complain about the interface-over-type-literal
rule. This is a questionable rule, so let's disable it in tslint.json
:
{
"extends": [
"tslint:recommended",
"tslint-react",
"tslint-config-prettier"
],
"linterOptions": {
"exclude": [
"config/**/*.js",
"node_modules/**/*.ts"
],
"rules": {
"interface-over-type-literal": false
}
}
}
Restart VS Code just in case. Now the TS Lint extension is cool, but running yarn start
gives a runtime exception:
Failed to compile
src/App.tsx
(7,6): Use an interface instead of a type literal.
This error occurred during the build time and cannot be dismissed.
Expected Behavior
This is definitely not an error, so this should not error and it should instead respect the reasonable request to disable the darn rule. It seems like react-scripts-ts
doesn't read tslint.json
correctly or something, but I think my tslint.json
syntax is okay as it did shut up the VS Code extension.
Actual Behavior
Failed to compile
src/App.tsx
(7,6): Use an interface instead of a type literal.
This error occurred during the build time and cannot be dismissed.
Reproducible Demo
See steps.