Skip to content

Conversation

arcticicestudio
Copy link
Contributor

Resolves #19

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

GH-19
@arcticicestudio arcticicestudio merged commit 484c981 into develop Aug 20, 2019
@arcticicestudio arcticicestudio deleted the feature/gh-19-eslinttypescript-config-pkg branch August 20, 2019 20:00
@arcticicestudio arcticicestudio removed their assignment Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESLint TypeScript Configuration Package
2 participants