Skip to content

Commit

Permalink
feat: Merge TypeScript into main config
Browse files Browse the repository at this point in the history
BREAKING CHANGE: There is no longer support for plain JavaScript files
  • Loading branch information
mskelton committed May 20, 2023
1 parent a30287c commit 2ef21bd
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 65 deletions.
28 changes: 6 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,23 @@
## Description

This package contains a simple and sensible ESLint config that you can use to
get up and running with a TypeScript or JavaScript project. It uses the
get up and running with a TypeScript. It uses the
[TypeScript ESLint parser](https://github.com/typescript-eslint/typescript-eslint)
and [Prettier](https://prettier.io).

## Installation

```sh
npm install -D @mskelton/eslint-config
npm install -D @mskelton/eslint-config eslint eslint-plugin-sort @typescript-eslint/eslint-plugin @typescript-eslint/parser
```

After installing the package, install the required peer dependencies.

```sh
npm install -D @babel/core @babel/eslint-parser eslint eslint-plugin-sort
```

### TypeScript
### React

If using TypeScript, install the following peer dependencies in addition to the
list above.
If using React, install the following peer dependencies in addition to the list
above.

```sh
npm install -D @typescript-eslint/eslint-plugin @typescript-eslint/parser
npm install -D eslint-plugin-react eslint-plugin-react-hooks
```

### Jest
Expand All @@ -43,15 +37,6 @@ above.
npm install -D eslint-plugin-jest
```

### React

If using React, install the following peer dependencies in addition to the list
above.

```sh
npm install -D eslint-plugin-react eslint-plugin-react-hooks
```

## Usage

In your `.eslintrc` file, add the following content including the configs you
Expand All @@ -61,7 +46,6 @@ want for your project.
{
"extends": [
"@mskelton",
"@mskelton/eslint-config/typescript",
"@mskelton/eslint-config/react",
"@mskelton/eslint-config/jest"
]
Expand Down
28 changes: 25 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
module.exports = {
extends: ["eslint:recommended", "plugin:sort/recommended", "prettier"],
parser: "@babel/eslint-parser",
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:sort/recommended",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
requireConfigFile: false,
},
plugins: ["sort"],
env: {
es6: true,
node: true,
},
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"no-useless-constructor": "off",
"sort/type-properties": "warn",
"sort/string-enums": "warn",
"sort/string-unions": "warn",
"no-unused-vars": [
"error",
{
Expand Down
13 changes: 2 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@
},
"main": "index.js",
"files": [
"typescript.js",
"jest.js",
"react.js",
"playwright.js"
],
"peerDependencies": {
"@babel/core": ">= 7",
"@babel/eslint-parser": ">= 7",
"@typescript-eslint/eslint-plugin": ">= 5",
"@typescript-eslint/parser": ">= 5",
"eslint": ">= 8",
Expand All @@ -37,20 +34,14 @@
"eslint-plugin-sort": ">= 2.10.0"
},
"peerDependenciesMeta": {
"@typescript-eslint/eslint-plugin": {
"eslint-plugin-react": {
"optional": true
},
"@typescript-eslint/parser": {
"eslint-plugin-react-hooks": {
"optional": true
},
"eslint-plugin-jest": {
"optional": true
},
"eslint-plugin-react": {
"optional": true
},
"eslint-plugin-react-hooks": {
"optional": true
}
},
"dependencies": {
Expand Down
29 changes: 0 additions & 29 deletions typescript.js

This file was deleted.

0 comments on commit 2ef21bd

Please sign in to comment.