Skip to content

Commit 5336480

Browse files
authored
Merge pull request #3 from weirdpattern/feat--split-prettier-support
Breaking changes
2 parents 6f2990b + d84cd53 commit 5336480

26 files changed

+1580
-1331
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/specs/samples/
2+
/coverage/

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text eol=lf

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock = false

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# v2.0.0
2+
[link](https://github.com/weirdpattern/eslint-config-typescript/compare/v1.1.0...v2.0.0)
3+
4+
This release contains **breaking changes**
5+
6+
* Move from manual configurations to `plugin:*/recommended`
7+
* Split prettier configuration in two
8+
* prettier.js will hold prettier + typescript configurations
9+
* prettier-react.js will hold prettier + typescript + react configurations
10+
* Update dependencies
11+
* Remove prettier and react from peer-dependencies
12+
* The dependencies are still required when using prettier and react configurations, but these way at least the user won't get the warning.
13+
* This comes handy when working on typescript projects that don't use react.
14+
15+
# v1.1.0
16+
[link](https://github.com/weirdpattern/eslint-config-typescript/compare/v1.0.2...v1.1.0)
17+
18+
* Simplified eslint configurations
19+
* Simplified build configurations
20+
* Add new typescript rules
21+
122
# v1.0.2
223
[link](https://github.com/weirdpattern/eslint-config-typescript/compare/v1.0.1...v1.0.2)
324

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,20 @@ A few ESLint plugins are supported as well:
2626
"typescript",
2727
"typescript/react",
2828
"typescript/prettier"
29+
"typescript/prettier-react"
2930
]
3031
}
3132
```
3233

34+
Note: `typescript/prettier-react` will automatically import `typescript/prettier`.
35+
3336
## Example configuration
3437
Using default prettier configurations:
3538
```json
3639
{
3740
"extends": [
3841
"typescript",
39-
"typescript/react",
40-
"typescript/prettier"
42+
"typescript/prettier"
4143
],
4244
"plugins": ["filenames", "jest"],
4345
"env": {
@@ -55,13 +57,13 @@ Using default prettier configurations:
5557
}
5658
```
5759

58-
Using specific prettier configurations:
60+
Using specific react configurations:
5961
```json
6062
{
6163
"extends": [
6264
"typescript",
6365
"typescript/react",
64-
"typescript/prettier"
66+
"typescript/prettier-react"
6567
],
6668
"plugins": ["filenames", "jest"],
6769
"env": {
@@ -80,8 +82,7 @@ Using specific prettier configurations:
8082
{
8183
"semi": false,
8284
"tabWidth": 4,
83-
"singleQuote": true,
84-
"parser": "typescript"
85+
"singleQuote": true
8586
}
8687
]
8788
}

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2017, WeirdPattern
2+
* Copyright (c) 2019, Patricio Trevino
33
* All rights reserved.
44
*
55
* This source code is licensed under the MIT-style license found in the

package.json

Lines changed: 45 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,64 @@
11
{
22
"license": "MIT",
3-
"version": "1.1.0",
3+
"version": "2.0.0",
44
"name": "eslint-config-typescript",
5-
"description": "An opinionated set of ESLint rules for TypeScript projects",
5+
"description": "A base set of recommended ESLint rules for TypeScript projects",
66
"author": "Patricio Trevino <patricio@weirdpattern.com>",
77
"repository": {
88
"type": "git",
99
"url": "https://www.github.com/weirdpattern/eslint-config-typescript.git"
1010
},
11-
"files": [
12-
"src/",
13-
"index.js",
14-
"prettier.js",
15-
"react.js"
16-
],
1711
"keywords": [
1812
"eslint",
1913
"config",
2014
"eslintconfig",
15+
"eslint-config",
2116
"typescript",
2217
"prettier",
2318
"react"
2419
],
20+
"files": [
21+
"src/",
22+
"index.js",
23+
"prettier.js",
24+
"prettier-react.js",
25+
"react.js"
26+
],
2527
"devDependencies": {
26-
"@types/node": "^10.3.6",
28+
"@types/node": "^10.12.21",
29+
"@typescript-eslint/eslint-plugin": "^1.2.0",
30+
"@typescript-eslint/parser": "^1.2.0",
2731
"create-react-class": "^15.6.3",
28-
"eslint": "^5.0.0",
29-
"eslint-config-prettier": "^2.9.0",
32+
"cross-spawn": "^6.0.5",
33+
"eslint": "^5.13.0",
34+
"eslint-config-prettier": "^4.0.0",
3035
"eslint-plugin-filenames": "^1.3.2",
31-
"eslint-plugin-prettier": "^2.6.1",
32-
"eslint-plugin-react": "^7.10.0",
33-
"eslint-plugin-typescript": "^0.12.0",
34-
"husky": "^0.14.3",
35-
"jest": "^23.2.0",
36-
"lint-staged": "^7.2.0",
37-
"prettier": "^1.13.6",
38-
"typescript": "^2.9.2",
39-
"typescript-eslint-parser": "^16.0.0"
36+
"eslint-plugin-jsdoc": "^4.1.0",
37+
"eslint-plugin-prettier": "^3.0.1",
38+
"eslint-plugin-react": "^7.12.4",
39+
"husky": "^1.3.1",
40+
"jest": "^24.0.0",
41+
"lint-staged": "^8.1.2",
42+
"prettier": "^1.16.3",
43+
"typescript": "^3.2.1"
4044
},
4145
"peerDependencies": {
42-
"eslint": "*",
43-
"eslint-config-prettier": "*",
44-
"eslint-plugin-prettier": "*",
45-
"eslint-plugin-react": "*",
46-
"eslint-plugin-typescript": "*",
47-
"prettier": "*",
48-
"typescript": "*",
49-
"typescript-eslint-parser": "*"
46+
"@typescript-eslint/eslint-plugin": ">=1.0.0",
47+
"@typescript-eslint/parser": ">=1.0.0",
48+
"eslint": ">=5.0.0",
49+
"typescript": ">=3.2.1"
5050
},
5151
"scripts": {
52-
"format": "npm run format:root && npm run format:src && npm run format:specs",
53-
"format:root": "prettier --write ./*.js",
54-
"format:src": "prettier --write ./src/{,**}/*.js",
55-
"format:specs": "prettier --write ./specs/{,**}/*.js",
56-
"lint": "npm run lint:root && npm run lint:src && npm run lint:specs",
57-
"lint:root": "eslint ./*.js",
58-
"lint:src": "eslint ./src/{,**}/*.js",
59-
"lint:specs": "eslint ./specs/{,**}/*.js",
52+
"lint": "eslint .",
6053
"test": "jest",
61-
"test:verbose": "jest --verbose",
6254
"test:coverage": "jest --coverage",
6355
"test:spec": "eslint --format json",
64-
"precommit": "lint-staged && npm test"
56+
"test:verbose": "jest --verbose"
57+
},
58+
"husky": {
59+
"hooks": {
60+
"pre-commit": "lint-staged && npm test"
61+
}
6562
},
6663
"lint-staged": {
6764
"*.js{,x}": [
@@ -70,8 +67,8 @@
7067
]
7168
},
7269
"eslintConfig": {
73-
"extends": ["eslint:recommended", "prettier"],
74-
"plugins": ["prettier", "filenames"],
70+
"extends": ["eslint:recommended", "plugin:jsdoc/recommended", "prettier"],
71+
"plugins": ["prettier", "filenames", "jsdoc"],
7572
"parserOptions": {
7673
"sourceType": "module",
7774
"ecmaVersion": 2015,
@@ -84,35 +81,16 @@
8481
"node": true,
8582
"jest": true
8683
},
84+
"settings": {
85+
"jsdoc": {
86+
"allowOverrideWithoutParam": true,
87+
"allowImplementsWithoutParam": true,
88+
"allowAugmentsExtendsWithoutParam": true
89+
}
90+
},
8791
"rules": {
8892
"semi": "error",
89-
"no-undef": "off",
90-
"no-unused-vars": "off",
91-
"require-jsdoc": "error",
92-
"no-console": [
93-
"error",
94-
{
95-
"allow": ["warn", "error"]
96-
}
97-
],
98-
"valid-jsdoc": [
99-
"error",
100-
{
101-
"preferType": {
102-
"any": "*",
103-
"Boolean": "boolean",
104-
"Number": "number",
105-
"Object": "object",
106-
"String": "string",
107-
"return": "returns"
108-
},
109-
"requireReturnType": true,
110-
"requireParamDescription": true,
111-
"requireReturnDescription": true
112-
}
113-
],
11493
"quotes": ["error", "double", { "avoidEscape": true }],
115-
"jsx-quotes": ["error", "prefer-single"],
11694
"filenames/match-exported": ["error", "kebab"],
11795
"prettier/prettier": "error"
11896
}
@@ -131,7 +109,7 @@
131109
"resetModules": true,
132110
"collectCoverage": false,
133111
"collectCoverageFrom": [
134-
"{index,prettier,react}.{j,t}s{,x}",
112+
"{index,prettier,prettier-react,react}.{j,t}s{,x}",
135113
"src/*.{j,t}s{,x}",
136114
"!**/*.min.js",
137115
"!**/static/**",

prettier-react.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright (c) 2019, Patricio Trevino
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
/* eslint-disable filenames/match-exported */
10+
11+
"use strict";
12+
13+
const configuration = require("./src/prettier");
14+
configuration.extends.push("prettier/react");
15+
16+
module.exports = configuration;
17+
18+
/* eslint-enable filenames/match-exported */

prettier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2017, WeirdPattern
2+
* Copyright (c) 2019, Patricio Trevino
33
* All rights reserved.
44
*
55
* This source code is licensed under the MIT-style license found in the

react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2017, WeirdPattern
2+
* Copyright (c) 2019, Patricio Trevino
33
* All rights reserved.
44
*
55
* This source code is licensed under the MIT-style license found in the

0 commit comments

Comments
 (0)