-
Notifications
You must be signed in to change notification settings - Fork 492
Show warnings instead of compiler errors #238
Comments
Indeed - the plugin we're using for It should be possible to use the |
Thanks for stopping by. I tried adding this to |
Sorry, it works, I put it under |
Just a note about this: Earlier versions used tslint-loader, which does not interrupt the build on linter failures by default. Current versions use fork-ts-checker-webpack-plugin for linting and typechecking in parallel, which counters performance penalties by sharing the |
@DorianGrey thanks for the clarification. |
Thoughts on changing the severity generated in the boilerplate file? I think it makes a lot of sense to have them be warnings instead of errors. |
Personally, I prefer linter errors to be quite aggressive, so that I'm forced to deal with them as soon as possible - even if that might be a bit tedious. However, it might make sense to reduce these messages down to warnings at least for development, but not for build mode. That'd be possible by providing two |
I'm just the opposite, especially considering that many linting errors can be fixed automatically - my workflow is leave the errors, run the entire project through autofix and then fix what's left. |
I'm on team warning with this. But it is definitely down to personal preference. |
@DorianGrey, what you are planning is easily achievable using the So apparently, in the upstream create-react-app, the usual practice is to treat linter issues as warnings during development, but as breaking errors during build. To be compatible with the upstream package, you might want to add Thanks! -Caghan |
@caghand I'm not sure if this |
I can't say I understand all the details about create-react-app, but I am sure the -Caghan |
OK, found it: create-react-app-typescript/packages/react-scripts/scripts/build.js Lines 129 to 141 in 7c0032b
That definitely requires some easier to find documentation, since this behavior is not only suitable for CI builds ... |
This might be relevant here: I agree that in development they should be warnings, and by default when CI is set warnings are treated as errors to align with the original CRA behavior; however since this project adds tslint which diverges, I would propose allowing another option to not treat the warnings as errors even when CI is enabled. This could be opened as separate issue for independent control of jest single run and tslint warnings, but this issue seems related. |
I've held off on commenting for a few days, but I think I have this same issue:
After the first load, this happens every time I save a file and the app tries to reload. It doesn't appear to be related to linting since there are no linting errors:
Unless cra-typescript is running different settings for linting. Just in case, I've tried changing the severity in tslint.json: {
"extends": ["tslint-react"],
"defaultSeverity": "warning"
} But that's the same issue. Here's my package versions: {
"dependencies": {
"@types/jest": "^22.1.1",
"@types/node": "^9.4.0",
"@types/react": "^16.0.35",
"@types/react-dom": "^16.0.3",
"@types/react-helmet": "^5.0.3",
"@types/react-router-dom": "^4.2.3",
"jest-styled-components": "^4.10.0",
"loadable-components": "^0.4.0",
"prettier": "^1.10.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-helmet": "^5.2.0",
"react-router-dom": "^4.2.2",
"react-scripts-ts": "2.13.0",
"react-snap": "^1.11.1",
"source-map-explorer": "^1.5.0",
"styled-components": "^3.1.4",
"ts-jest": "^22.0.2",
"tslint": "^5.9.1",
"tslint-react": "^3.4.0",
"typescript": "^2.6.2",
"typescript-styled-plugin": "^0.4.0",
"whatwg-fetch": "^2.0.3"
}
} Edit: I've tried Any ideas? |
Definitely don't think that's the same issue. I would suggest opening a new one :) |
"defaultSeverity": "warning" will only work for tslint rules. |
In case anyone is interested, here's what I came up with to only throw a warning rather than an error (in development only) for unused locals: |
I started a project now with create-react-app-typescript and everytime I make a mistake (according to tslint rules) it's not compiling until I fix it.
It is strange, because I made a project couple of months ago with this tool and it showed the errors, but it did compile my code. I didn't change anything in the config files.
How can I switch the beaviour back?
The text was updated successfully, but these errors were encountered: