Skip to content

Commit ad70b25

Browse files
committed
feat(configurations): split prettier configuration, update dependencies, improve build process
1 parent 6f2990b commit ad70b25

27 files changed

+1145
-731
lines changed

.eslintignore

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

.gitattributes

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

.npmignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**/*
2+
!src
3+
!index.js
4+
!react.js
5+
!prettier.js
6+
!prettier-react.js
7+
!package.json
8+
!CHANGELOG.md
9+
!README.md
10+
!LICENSE

.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: 37 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,56 @@
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
],
2520
"devDependencies": {
26-
"@types/node": "^10.3.6",
21+
"@typescript-eslint/eslint-plugin": "^1.0.0",
22+
"@typescript-eslint/parser": "^1.0.0",
2723
"create-react-class": "^15.6.3",
28-
"eslint": "^5.0.0",
29-
"eslint-config-prettier": "^2.9.0",
24+
"cross-spawn": "^6.0.5",
25+
"eslint": "^5.12.1",
26+
"eslint-config-prettier": "^3.6.0",
3027
"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"
28+
"eslint-plugin-jsdoc": "^4.0.1",
29+
"eslint-plugin-prettier": "^3.0.1",
30+
"eslint-plugin-react": "^7.12.4",
31+
"husky": "^1.3.1",
32+
"jest": "^23.6.0",
33+
"lint-staged": "^8.1.0",
34+
"prettier": "^1.16.0",
35+
"typescript": "^3.2.4"
4036
},
4137
"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": "*"
38+
"@typescript-eslint/eslint-plugin": ">=1.0.0",
39+
"@typescript-eslint/parser": ">=1.0.0",
40+
"eslint": ">=5.0.0",
41+
"typescript": ">=3.2.1"
5042
},
5143
"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",
44+
"lint": "eslint .",
6045
"test": "jest",
61-
"test:verbose": "jest --verbose",
6246
"test:coverage": "jest --coverage",
6347
"test:spec": "eslint --format json",
64-
"precommit": "lint-staged && npm test"
48+
"test:verbose": "jest --verbose"
49+
},
50+
"husky": {
51+
"hooks": {
52+
"pre-commit": "lint-staged && npm test"
53+
}
6554
},
6655
"lint-staged": {
6756
"*.js{,x}": [
@@ -70,8 +59,8 @@
7059
]
7160
},
7261
"eslintConfig": {
73-
"extends": ["eslint:recommended", "prettier"],
74-
"plugins": ["prettier", "filenames"],
62+
"extends": ["eslint:recommended", "plugin:jsdoc/recommended", "prettier"],
63+
"plugins": ["prettier", "filenames", "jsdoc"],
7564
"parserOptions": {
7665
"sourceType": "module",
7766
"ecmaVersion": 2015,
@@ -84,35 +73,16 @@
8473
"node": true,
8574
"jest": true
8675
},
76+
"settings": {
77+
"jsdoc": {
78+
"allowOverrideWithoutParam": true,
79+
"allowImplementsWithoutParam": true,
80+
"allowAugmentsExtendsWithoutParam": true
81+
}
82+
},
8783
"rules": {
8884
"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-
],
11485
"quotes": ["error", "double", { "avoidEscape": true }],
115-
"jsx-quotes": ["error", "prefer-single"],
11686
"filenames/match-exported": ["error", "kebab"],
11787
"prettier/prettier": "error"
11888
}
@@ -131,7 +101,7 @@
131101
"resetModules": true,
132102
"collectCoverage": false,
133103
"collectCoverageFrom": [
134-
"{index,prettier,react}.{j,t}s{,x}",
104+
"{index,prettier,prettier-react,react}.{j,t}s{,x}",
135105
"src/*.{j,t}s{,x}",
136106
"!**/*.min.js",
137107
"!**/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

0 commit comments

Comments
 (0)