This repository was archived. And eslint-config-p-ts
was renamed and moved to appropriate organization.
Please don't use this package.
This package provides P's base TS .eslintrc as an extensible shared config.
This configure was created from this document. https://github.com/basarat/typescript-book/blob/master/docs/styleguide/styleguide.md
Yes, it is useless, but rules is not unnecessary in rules.
I think, don't use prefix I
is also perfect rule.
You can customize it in your project.
Bad
interface MyProps {
hoge: string;
fuga: number;
}
Good
interface IMyProps {
hoge: string;
fuga: number;
}
Please ignore this when needs use default export in framework. (eg Nuxt's middleware)
Bad
class Foo {}
export default Foo;
Good
export class Foo {}
In TypeScript, you can separate interfaces with semicolons, also can use commas too. But modern coding rule is recommended use semicolon.
Bad
interface Hoge {
huga: string,
piyo: number,
}
const foo: { bar: string, baz: number } = { bar: 'bar', baz: 0 };
Good
interface Hoge {
huga: string;
piyo: number;
}
const foo: { bar: string; baz: number; } = { bar: 'bar', baz: 0 };
Packaged our JavaScript / TypeScript coding standard.
- Install dependencies packages.
yarn add -D eslint-config-p-ts
- Add your
.eslintrc
'sextends
section.
extends: ['p-ts']
Please note here has meaning to the position. We prefer put it last or put before prettier
.