Skip to content

Commit dd93797

Browse files
author
aMarCruz
committed
v0.9.0
1 parent 66d51c1 commit dd93797

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1272
-1204
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

.eslintrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"root": true,
3+
"extends": ["./index.js", "./typescript.js"]
4+
}

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
.eslintrc.js
21
.vscode
32
node_modules

.prettierrc.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
{
2-
"offsetTernaryExpressions": true,
32
"arrowParens": "avoid",
43
"bracketSpacing": true,
54
"generatorStarSpacing": true,
6-
"printWidth": 120,
5+
"offsetTernaryExpressions": true,
6+
"printWidth": 92,
77
"quoteProps": "consistent",
88
"semi": false,
99
"singleQuote": true,
1010
"spaceBeforeFunctionParen": true,
11-
"yieldStarSpacing": true,
12-
"overrides": [
13-
{
14-
"files": ".prettierrc",
15-
"options": { "parser": "json" }
16-
},
17-
{
18-
"files": ".babelrc",
19-
"options": { "parser": "json" }
20-
}
21-
]
11+
"yieldStarSpacing": true
2212
}

.vscode/settings.json

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
{
2-
"files.associations": {
3-
"lib/*.json": "jsonc",
4-
"src/*.json": "jsonc",
5-
},
6-
"eslint.autoFixOnSave": true,
7-
"eslint.packageManager": "yarn",
8-
"eslint.validate": [
9-
"javascript",
10-
"javascriptreact",
11-
{ "language": "typescript", "autoFix": true },
12-
{ "language": "typescriptreact", "autoFix": true }
13-
],
142
"typescript.disableAutomaticTypeAcquisition": true,
153
"typescript.format.insertSpaceAfterConstructor": true,
164
"typescript.format.insertSpaceBeforeFunctionParenthesis": true,
175
"typescript.suggest.completeFunctionCalls": true,
186
"typescript.tsdk": "node_modules/typescript/lib",
197
"javascript.validate.enable": false,
20-
"editor.formatOnSave": true,
8+
"eslint.format.enable": true,
219
"[markdown]": {
22-
"editor.formatOnSave": true
10+
"editor.defaultFormatter": "esbenp.prettier-vscode",
11+
"editor.formatOnSave": true,
12+
"editor.quickSuggestions": true,
13+
"editor.wordWrap": "on",
14+
"files.trimTrailingWhitespace": false
2315
},
2416
"[json]": {
17+
"editor.defaultFormatter": "esbenp.prettier-vscode",
2518
"editor.formatOnSave": true
2619
},
2720
"[jsonc]": {
21+
"editor.defaultFormatter": "esbenp.prettier-vscode",
2822
"editor.formatOnSave": true
2923
},
30-
"files.exclude": {
31-
"**/node_modules": false
32-
},
33-
"editor.codeActionsOnSave": {
34-
"source.fixAll.eslint": true
24+
"[javascript]": {
25+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
26+
"editor.formatOnSave": true,
3527
},
3628
}

CHANGELOG.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,65 @@
11
# Changes for eslint-config-standardize
22

3+
## \[0.9.0] - 2021-04-27
4+
5+
### added
6+
7+
- `no-return-await` as "warn"
8+
- `no-useless-constructor` as "error"
9+
- `node/no-unpublished-require` as "error"
10+
- `node/shebang` as "error"
11+
- `unicorn/no-array-push-push` as "warn"
12+
- `unicorn/prefer-array-index-of` as "warn"
13+
- `unicorn/prefer-date-now` as "warn"
14+
- `@typescript-eslint/default-param-last` as "error" (extends the ESlint rule)
15+
- `@typescript-eslint/no-dupe-class-members` as "error" (extends the ESlint rule)
16+
- `@typescript-eslint/no-duplicate-imports` as "error" (extends the ESlint rule)
17+
- `@typescript-eslint/no-redeclare` as "error" (extends the ESlint rule)
18+
- `react/no-children-prop` as "error"
19+
- `react/no-danger-with-children` as "error"
20+
- `react/no-find-dom-node` as "error"
21+
- `react/no-render-return-value` as "error"
22+
- `react/no-this-in-sfc` as "error"
23+
- `react/void-dom-elements-no-children` as "error"
24+
- `react/jsx-no-bind` as "error"
25+
- `react/jsx-no-target-blank` as "error" with `enforceDynamicLinks:always`
26+
- `react/jsx-no-useless-fragment` as "error"
27+
28+
### Removed
29+
30+
- `no-restricted-syntax` as "WithStatement" is replaced with `no-with`
31+
- `prefer-arrow-callback` (was "off")
32+
- `@typescript-eslint/array-type` as it's too opinionated
33+
- `import/named` (was "error")
34+
35+
### Changed
36+
37+
- Add `document`, `navigator`, `window` to ESLint `globals`, as StandardJS does.
38+
- Add `convertPath` option to `settings/node` for "./src/bin" to "./bin" translation.
39+
- Add options to allow "amd" in `import/no-absolute-path`
40+
- Add `"#__INLINE__"` and `"#__NOINLINE__"` to markers of block in `spaced-comment`
41+
- Add `noTemplateLiterals` option to `react/no-string-refs`
42+
- Change `complexity` from 10 to 12
43+
- Change `curly` from "error" to "warn"
44+
- Change `commentPattern` from "^no ?default$" to "^no default$" (require space) in `default-case`.
45+
- Change `react/jsx-max-depth` from 5 to 6
46+
- Change `unicorn/no-unreadable-array-destructuring` from "error" to "warn"
47+
- Change `unicorn/better-regex` from "error" to "warn"
48+
- Replaced `unicorn/no-array-instanceof` with `unicorn/no-instanceof-array`
49+
- Replaced `unicorn/prefer-text-content` with `unicorn/prefer-dom-node-text-content`
50+
- Replaced `unicorn/prefer-node-remove` with `unicorn/prefer-dom-node-remove`
51+
- Replaced `unicorn/prefer-event-key` with `unicorn/prefer-keyboard-event-key`
52+
- Replaced `unicorn/prefer-starts-ends-with` with `unicorn/prefer-string-starts-ends-with`
53+
- Revert `@typescript-eslint/member-delimiter-style` singleline delimiter to 'semi'
54+
- Remove `allowInPropTypes` option from `react/forbid-foreign-prop-types`
55+
- Remove `allowAllCaps` option in `react/jsx-pascal-case`
56+
- Now the rules are extracted and prepared from the prettierx, standard, and standard-jsx configurations at build time, so its packages are not required at runtime and have been moved to `devDependencies`.
57+
- [eslint-plugin-prettierx](https://www.npmjs.com/package/eslint-plugin-prettierx) is included and enabled in this package. You don't need to include the "eslint-plugin-prettierx/standardize-bundle" configuration.
58+
- Scripts have been added to package.json to list obsolete and unused rules. This through the [eslint-find-rules](https://www.npmjs.com/package/eslint-find-rules) package.
59+
- The rule `@typescript-eslint/naming-convention` has been relaxed to allow edge cases.
60+
- Workaround for typescript-eslint/typescript-eslint#2540 bug with `no-use-before-define`.
61+
- Update dependencies.
62+
363
## \[0.8.0] - 2021-02-07
464

565
### Changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019-2020 Alberto Martínez
3+
Copyright (c) 2019-2021 Alberto Martínez
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,30 @@
33
[![License][license-badge]][license-url]
44
[![npm Version][npm-badge]][npm-url]
55

6-
For use with ESLint v7.17.0 and above, for previous versions use eslint-config-standardize 0.7.x or bellow.
6+
## IMPORTANT
77

8-
Minimum NodeJS version supported: 10.13, 12.0, or above (ESLint 7 compatible).
8+
eslint-config-standardize was my first attempt to integrate ESLint with TypeScript and React. Currently, the package that my team and I use is [@quitsmx/eslint-config](https://github.com/quitsmx/eslint-config). With TypeScript and PrettierX integrated, this one is more modern and easier to use. I would recommend you give it a try, eslint-config-standardize will be discontinued soon.
9+
10+
---
11+
12+
Customizable ESLint config backed by [StandardJS](https://www.npmjs.com/package/eslint-config-standard) rules and [PrettierX](https://www.npmjs.com/package/prettierx) formatting.
13+
14+
For use with ESLint v7.0 and above, for previous versions use eslint-config-standardize 0.7.x or bellow.
15+
16+
Minimum Node.js version: 10.13, 12.0, or above.
17+
18+
**NOTE:**
19+
20+
From v0.9.0, [eslint-plugin-prettierx](https://www.npmjs.com/package/eslint-plugin-prettierx) is included and enabled in this package. You don't need to include the "eslint-plugin-prettierx/standardize-bundle" config.
921

1022
## Setup
1123

1224
Install from npm (omit eslint if it's already installed or you are using CRA).
1325

1426
```sh
15-
npm i eslint eslint-config-standardize -D
27+
npm install -D eslint eslint-config-standardize
1628
# or
17-
yarn add eslint eslint-config-standardize -D
29+
yarn add -D eslint eslint-config-standardize
1830
```
1931

2032
In your ESLint config file:
@@ -29,13 +41,13 @@ module.exports = {
2941

3042
### With TypeScript
3143

32-
If you are using TypeScript, add "standardize/typescript" in "extends".
44+
If you are using TypeScript, install the parser and the eslint plugin
3345

3446
```bash
3547
yarn add @typescript-eslint/parser @typescript-eslint/eslint-plugin -D
3648
```
3749

38-
In your eslint config
50+
then add "standardize/typescript" to your eslint config
3951

4052
```js
4153
// .eslintrc.js
@@ -55,22 +67,25 @@ You don't need to do anything else, the config automatically detects React and P
5567

5668
- [import](https://www.npmjs.com/package/eslint-plugin-import)
5769
- [node](https://www.npmjs.com/package/eslint-plugin-node)
70+
- [prettierx](https://www.npmjs.com/package/eslint-plugin-prettierx)
5871
- [promise](https://www.npmjs.com/package/eslint-plugin-promise)
5972
- [react](https://www.npmjs.com/package/eslint-plugin-react)
6073
- [react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)
6174
- [unicorn](https://www.npmjs.com/package/eslint-plugin-unicorn)
6275

6376
## Differences vs StandardJS
6477

65-
Standardize uses a more strict and opinionated configuration than Standard, so almost all the code passes with no problems through the StandardJS linter, but has some differences with the default settings of StandardJS/Prettier.
78+
Standardize uses a more strict and opinionated configuration than _StandardJS_ and include the react-hooks and unicorn plugins.
79+
80+
Almost all the code passes with no problems through the StandardJS linter, but has some differences with the default settings of StandardJS/PrettierX. This is the most important:
6681

6782
### Multiline Ternary
6883

69-
The formating of multiline ternary is a mess, altough the result seems to be inlined with the StandardJS rules. See [Known Issues](#known-issues).
84+
The formatting of multiline ternary is a mess, although the result seems to be inline with the StandardJS rules. See [Known Issues](#known-issues).
7085

7186
### Trailing Commas
7287

73-
Altough StandardJS avoids trailing commas in all, this is a common practice as it helps to clarify commits.
88+
Although _StandardJS_ avoids trailing commas in all, this is a common practice as it helps to clarify commits.
7489

7590
Standardize leaves everything to 'always', except for the function parameters (Prettier's `trailingComma: 'es5'` option).
7691

@@ -84,14 +99,6 @@ The React style favors double quotes in properties, and I agree.
8499
ESLint rule: [`jsx-quotes`](https://eslint.org/docs/rules/jsx-quotes)
85100
Prettier: [`jsxSingleQuote`](https://prettier.io/docs/en/options.html#jsx-quotes)
86101

87-
### Spaced comment
88-
89-
Adds `#`, `#region`, `#endregion` (VS Code directives) to the line markers.
90-
Adds `#__PURE__` (uglify/terser directive) to the block markers.
91-
92-
ESLint rule: [`spaced-comment`](https://eslint.org/docs/rules/spaced-comment)
93-
Prettier: N/A
94-
95102
### Quote Props
96103

97104
Both Prettier and StandardJS enclose the properties in quotes "as needed", this looks ugly with syntax highlighting on large JS objects (such as those used in configurations) and is inconsistent at object level. I prefer `"consistent"`.
@@ -101,33 +108,11 @@ Prettier: [`quoteProps`](https://prettier.io/docs/en/options.html#quote-props)
101108

102109
### eslint-plugin-prettierx
103110

104-
The [eslint-plugin-prettierx](https://github.com/aMarCruz/eslint-plugin-prettierx) can be used to format JS code. It have a preset for the standardize bundle.
105-
106-
This example is using standardize with the prettierx plugin:
107-
108-
```bash
109-
# install requirements
110-
yarn add eslint eslint-plugin-prettierx eslint-config-standardize
111-
```
112-
113-
Configure eslint:
114-
115-
```js
116-
// .eslintrc.js
117-
module.exports = {
118-
plugins: [
119-
'prettierx'
120-
]
121-
extends: [
122-
'standardize',
123-
'plugin:prettierx/standardize-bundle',
124-
],
125-
}
126-
```
111+
The [eslint-plugin-prettierx](https://github.com/aMarCruz/eslint-plugin-prettierx) **is used** to format the JS code. You don't need install PrettierX.
127112

128-
Done.
113+
This plugin is a excellent alternative to the VS Code 'Prettier - Code formatter' extension.
129114

130-
This plugin is a excellent alternative to the VS Code 'Prettier - Code formatter' extension. See [here](https://github.com/aMarCruz/eslint-plugin-prettierx#vs-code-eslint) to know how to configure it.
115+
See [here](https://github.com/aMarCruz/eslint-plugin-prettierx#vs-code-eslint) to know how to configure it.
131116

132117
## Support my Work
133118

@@ -141,7 +126,7 @@ Thanks for your support!
141126

142127
## License
143128

144-
The [MIT](LICENSE) License © 2019-2020 Alberto Martínez
129+
The [MIT](LICENSE) License © 2019-2021 Alberto Martínez
145130

146131
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat
147132
[license-url]: https://github.com/aMarCruz/eslint-config-standardize/blob/master/LICENSE

bin/list-eslint-config.js

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)