Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ESLint TypeScript Configuration Package (#20)
To support projects build with TypeScript (1), a new `@arcticicestudio/eslint-config-typescript` package has been implemented using the awesome @typescript-eslint (2) project. It will mainly extend `@typescript-eslint/eslint-plugin`'s already provided and recommended configurations (3) in order to adapt best practices: 1. `plugin:@typescript-eslint/eslint-recommended` 2. `plugin:@typescript-eslint/recommended` 3. `plugin:@typescript-eslint/recommended-requiring-type-checking` The `@typescript-eslint/parser` (4) is set as ESLint parser. Also as of `@typescript-eslint/parser` version `2.0.0` (5) (also see typescript-eslint/typescript-eslint#890 (6)), the parser will panic when parsing files that are not included within the provided tsconfig(s). The package documentation contains instructions and a quick setup and usage guide to inform about the required `tsconfig` configurations (7) and the corresponding `eslintrc` changes. Next to the support for TypeScript, the package also modifies some React and import related rules in order to prevent conflicts, like the adaption of the `.ts` and `.tsx` extensions for all JS and JSX files as well as removing `.jsx` to force the usage of `.tsx`. There are other rules that have been disabled like the check for valid React `prop-types` since these and not necessary anymore when working with TypeScript. The new package provides two entry points, available as `@arcticicestudio/eslint-config-typescript` (main) and `@arcticicestudio/eslint-config-typescript/prettier` that can both be composed with all other available entry points (8) to inherit their rules. This package mainly depends on the `@typescript-eslint/eslint-plugin@^2.0.0` and `@typescript-eslint/parser@^2.0.0` packages as peer dependencies. References: (1) https://www.typescriptlang.org (2) https://github.com/typescript-eslint/typescript-eslint (3) https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/src/configs (4) https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser (5) https://github.com/typescript-eslint/typescript-eslint/releases/tag/v2.0.0 (6) typescript-eslint/typescript-eslint#890 (7) https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#configuration (8) https://github.com/arcticicestudio/styleguide-javascript/blob/develop/packages/%40arcticicestudio/eslint-config/README.md#entry-points Resolves GH-19
- Loading branch information