infeng / vscode-react-typescript Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi, this is more a question rather than an issue. I was curious about why it was decided to go for
import * as React from 'react';
Instead of import React from 'react'
.
The other question is about the usage of interfaces rather than types. I know this is kind of "controvertial" but why it was decided to include one over the other.
Thanks in advance, the snippets are awesome.
Currently, it's exported.
But if one file only contains one function, it should be default exported.
Please implement a setting where you can choose between double or single quotes.
It creates
import * as React from 'react';
export interface IAppProps {
}
export function IApp (props: IAppProps) {
return (
<div>
</div>
);
}
But all IApp
are selected, while I in the interface should not be selected.
This is a really promising tool. Thank you for your work on this. Not so much an issue but a request.
I have found that the image provided in the readme file does not quite give me enough context to build an app using these snippets. It would be really useful if there was a codepen or JSFiddle I could reference to understand how an app using these snippets hangs together.
Many thanks
"tsrrc" command in the documentation shall be corrected to "tscntr"
Issue Type: Bug
fails
Extension version: 1.3.1
VS Code version: Code 1.51.1 (e5a624b788d92b8d34d1392e4c4d9789406efe8f, 2020-11-11T01:11:34.018Z)
OS version: Darwin x64 20.1.0
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz (12 x 3200) |
GPU Status | 2d_canvas: enabled flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on protected_video_decode: unavailable_off rasterization: enabled skia_renderer: disabled_off_ok video_decode: enabled webgl: enabled webgl2: enabled |
Load (avg) | 5, 5, 5 |
Memory (System) | 64.00GB (18.16GB free) |
Process Argv | --crash-reporter-id 216c0c75-6d64-4284-9807-08dd00785e6d |
Screen Reader | no |
VM | 0% |
I've used this extension for a couple of weeks but today I got tired of removing I-s from Interface names, so I read up on all guidelines and practices I found and it seems most agree with me.
I know this was changed as a response to #11 but I'd like to point out that that problem was caused by a setting in someones tslint file, probably one like this: https://palantir.github.io/tslint/rules/interface-name/
The official Typescript documemtation clearly avoids prefixing interface names with I as seen here: https://www.typescriptlang.org/docs/handbook/interfaces.html, which is reasonable since Typescript is a typed language mostly written in IDEs where syntax hightlighting is good and it is easy to lookup definitions.
Also the guidelines for developing Typescript, while not prescriptive for projects using Typescript, also tells contributors to not prefix interface names with I: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines
Also here is a stackoverflow answer that add some detail: https://stackoverflow.com/a/41967120
For anyone who says: "but the tslint must be right", I'd like to point out that this is easily adjustable, just set "interface-name": [true, "never-prefix"]
and you'll get sane behaviour from tslint from now on :-)
I'll probably just create my own snippets but I thought it was worth pointing out as a way to give something back help avoid people doing what I and many other thinks is a bad thing just because the default template suggest it.
Alternatively we can keep both, just prefix the current ones with dndt_
(for do not do this) and add a comment with a TODO: fix tslint-files to not suggest prefixing interfaces with I, see: https://stackoverflow.com/a/41967120
;-)
Can you please add something like this ..
import * as React from 'react';
interface WelcomeProps {
};
const Welcome: React.SFC<WelcomeProps> = (props) => {
return <h1>Hello</h1>;
}
TSLint naming conventions ask that Interfaces start with I
, can we add that to the snippets?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.