Comments (10)
just in case other people run into the same issue:
You are not supposed to change the "jsx" version in tsconfig, that happens because you are using vscode integrated typescript, whereas create-react-app is already a few versions ahead, you can revert your change and use 'rect-jsx' if you tell vscode to use the packaged typescript inversion from node_modules instead of the bundled one
As for the other stuff, I ran into more problems with the rules, 100% explicit typing for example, that is just a waste of time so I really gave up on trying to stick to this flavor of standard and I'm using pure eslint with the typescript-eslint-standard rule set which allows for customization, I know it is not the philosophy of standard but I think current ts rule set is too strict for it's own good.
Thanks for the support anyways
from ts-standard.
A bit more information, I added the following config on my package.json
:
"ts-standard": {
"parser": "babel-eslint",
"env": [
"jest",
"es6",
"browser"
],
"ignore": [
"build/*"
]
}
and on my workspace settings:
{
"typescript.tsdk": "node_modules/typescript/lib",
"standard.autoFixOnSave": true,
"javascript.validate.enable": false,
"standard.engine": "ts-standard",
"standard.usePackageJson": true
}
and that effectively got rid of the error on vscode, however when running on the browser, the error pops again and breaks the compilation of the program
from ts-standard.
never mind, nothing wrong with this package, seems it is disabled on the eslint rule set itself
mightyiam/eslint-config-love#422
the fact there is no description of the error though, is very very confusing
from ts-standard.
@ospfranco is your file ending in .js
? This isn't the rule that is complaining, the parser is complaining that it can't understand the file (since !
there is only valid TypeScript, not JavaScript)
from ts-standard.
no, my file is valid typescript, after I removed ts-standard and manually installed the standard-typescript-eslint configuration and modified the rule myself it ran without problems
from ts-standard.
my file is valid typescript
Yes, exactly. But it isn't valid JavaScript, and it seems like ts-standard
is trying to parse the file as JavaScript. I'm trying to figure out why that is.
Is the file extension of your file .js
, or is it .ts
?
Potentially ts-standard looks at the file ending, whilst a custom eslintrc config wouldn't...
from ts-standard.
no, it was a .ts
file
from ts-standard.
Interesting, I don't have time to setup a create-react-app and test right now, but it should work out of the box with ts-standard so something is broken 🤔
from ts-standard.
So update on this from my end.
I just created a default create-react-app
using the following command npx create-react-app my-app --template typescript --use-npm
.
I then proceeded to install ts-standard
and run ts-standard --fix
there were a few errors (because the template is not standard
compliant). I also had to update the tsconfig.json
to use "jsx": "react"
instead of "react-jsx"
which does not exist.
After fixing all of that, ts-standard
ran as expected. One thing I noticed in the original config sent was the usage of babel-eslint
for the parser
setting. When I added that, everything went crazy and ts-standard
broke. ts-standard
already includes the correct parser so there is rarely ever a reason to change the parser. If you wish to change the parser I suggest just using standard
with the custom parser instead.
If someone really wants to make ts-standard
compatible with the babel
parser, they are welcome to open a PR for it. I suspect it will be quite challenging as babel
's typescript
parser does not support the full typescript language specification.
from ts-standard.
@ospfranco thanks for the great feedback. I appreciate all of it and I do understand your concern about the rules. Please feel free to open an issue regarding the rules or a specific rule in https://github.com/standard/eslint-config-standard-with-typescript where all the rules are determined and can be changed. The Typescript side of the rules is very much still evolving and changing as more people begin to use them, so any and all rule change suggestions are welcomed 😄
from ts-standard.
Related Issues (20)
- Support eslint-env and global HOT 2
- Usage of ESM imports instead of CommonJS HOT 7
- npm version 10.0.0 is actually different HOT 2
- Error: failed to load plugin HOT 3
- ts-standard: Unexpected linter output HOT 2
- project package option does not support glob patterns
- Package does not provide `@typescript-eslint/parser` HOT 1
- Can ts-standard use v5.12.1 or higher of @typescript-eslint/parser? HOT 8
- --fix for "An explicit null check is required" breaks code HOT 1
- Release v12.0.0 (latest changes on `master` branch) HOT 3
- The `--version` flag requires the `--project` flag HOT 1
- Automated release process
- Allow `--project` to accept an absolute path HOT 3
- ts-standard is linting *.min.js files HOT 1
- After upgrade to v12 TypeScript Standard Style server is not able to find tsconfig.json HOT 3
- --stdin-filename option is gone and now stdin is completely broken again HOT 1
- Release v12.0.2 HOT 1
- react/require-render-return fires for non-react code
- Add support for @typescript/eslint version 6.x.x
- Deprecate and point to `eslint-config-standard-with-typescript` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ts-standard.