eslint-config-prettier 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### Version 3.3.0 (2018-11-11)
2
+
3
+ - Added: The [vue/html-self-closing] rule (as a [special
4
+ rule][vue/html-self-closing-special]). Thanks to Yamagishi Kazutoshi (@ykzts)!
5
+
1
6
  ### Version 3.2.0 (2018-11-10)
2
7
 
3
8
  - Added: Support for [eslint-plugin-vue].
@@ -201,3 +206,5 @@
201
206
  [semi-style]: https://eslint.org/docs/rules/semi-style
202
207
  [switch-colon-spacing]: https://eslint.org/docs/rules/switch-colon-spacing
203
208
  [template-tag-spacing]: https://eslint.org/docs/rules/template-tag-spacing
209
+ [vue/html-self-closing]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md
210
+ [vue/html-self-closing-special]: https://github.com/prettier/eslint-config-prettier/blob/d5e7af986221df5faedc12893d8dc3150a808693/README.md#vuehtml-self-closing
package/README.md CHANGED
@@ -27,6 +27,7 @@ choices get in the way when using Prettier.
27
27
  - [Forbid unnecessary backticks](#forbid-unnecessary-backticks)
28
28
  - [Example _double_ quote configuration](#example-_double_-quote-configuration)
29
29
  - [Example _single_ quote configuration](#example-_single_-quote-configuration)
30
+ - [vue/html-self-closing](#vuehtml-self-closing)
30
31
  - [Other rules worth mentioning](#other-rules-worth-mentioning)
31
32
  - [no-sequences](#no-sequences)
32
33
  - [Contributing](#contributing)
@@ -126,7 +127,8 @@ Exit codes:
126
127
  "prettier/flowtype",
127
128
  "prettier/react",
128
129
  "prettier/standard",
129
- "prettier/unicorn"
130
+ "prettier/unicorn",
131
+ "prettier/vue"
130
132
  ],
131
133
  "plugins": [
132
134
  "flowtype",
@@ -407,6 +409,19 @@ required):
407
409
  }
408
410
  ```
409
411
 
412
+ **Note:** Since [ESlint 5.7.0] this rule can be configured to work regardless of
413
+ your Prettier configuration:
414
+
415
+ ```json
416
+ {
417
+ "rules": {
418
+ "no-tabs": ["error", {"allowIndentationTabs": true}]
419
+ }
420
+ }
421
+ ```
422
+
423
+ A future version of eslint-config-prettier might check for that automatically.
424
+
410
425
  ### [no-unexpected-multiline]
411
426
 
412
427
  **This rule requires special attention when writing code.**
@@ -577,6 +592,44 @@ Prettier:
577
592
  }
578
593
  ```
579
594
 
595
+ ### [vue/html-self-closing]
596
+
597
+ This rule enforces whether elements should be self-closing or not.
598
+
599
+ Prettier generally preserves the way you wrote your elements:
600
+
601
+ ```vue
602
+ <div />
603
+ <div></div>
604
+ <MyComponent />
605
+ <MyComponent></MyComponent>
606
+ <svg><path d="" /></svg>
607
+ <svg><path d=""></path></svg>
608
+ ```
609
+
610
+ But for known _void_ HTML elements, Prettier always uses the self-closing style.
611
+ For example, `<img>` is turned into `<img />`.
612
+
613
+ If you like this rule, it can be used just fine with Prettier as long as you
614
+ set `html.void` to `"any"`.
615
+
616
+ Example ESLint configuration:
617
+
618
+ ```json
619
+ {
620
+ "rules": {
621
+ "vue/html-self-closing": [
622
+ "error",
623
+ {
624
+ "html": {
625
+ "void": "any"
626
+ }
627
+ }
628
+ ]
629
+ }
630
+ }
631
+ ```
632
+
580
633
  ## Other rules worth mentioning
581
634
 
582
635
  These rules don’t conflict with Prettier, but have some gotchas when used with
@@ -715,6 +768,7 @@ several other npm scripts:
715
768
 
716
769
  [MIT](LICENSE).
717
770
 
771
+ [ESlint 5.7.0]: https://eslint.org/blog/2018/10/eslint-v5.7.0-released
718
772
  [Prettier]: https://github.com/prettier/prettier
719
773
  [curly]: https://eslint.org/docs/rules/curly
720
774
  [eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype
@@ -739,3 +793,4 @@ several other npm scripts:
739
793
  [string formatting rules]: https://prettier.io/docs/en/rationale.html#strings
740
794
  [travis-badge]: https://travis-ci.org/prettier/eslint-config-prettier.svg?branch=master
741
795
  [travis]: https://travis-ci.org/prettier/eslint-config-prettier
796
+ [vue/html-self-closing]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md
package/bin/validators.js CHANGED
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ // These validator functions answer the question “Is the config valid?” – return
4
+ // `false` if the options DO conflict with Prettier, and `true` if they don’t.
5
+
3
6
  module.exports = {
4
7
  curly(options) {
5
8
  if (options.length === 0) {
@@ -34,5 +37,18 @@ module.exports = {
34
37
 
35
38
  const firstOption = options[0];
36
39
  return !(firstOption && firstOption.allowParens);
40
+ },
41
+
42
+ "vue/html-self-closing"(options) {
43
+ if (options.length === 0) {
44
+ return false;
45
+ }
46
+
47
+ const firstOption = options[0];
48
+ return Boolean(
49
+ firstOption && (firstOption.html && firstOption.html.void === "any")
50
+ // Enable when Prettier supports SVG: https://github.com/prettier/prettier/issues/5322
51
+ // && firstOption.svg === "any"
52
+ );
37
53
  }
38
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-prettier",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "license": "MIT",
5
5
  "author": "Simon Lydell",
6
6
  "description": "Turns off all rules that are unnecessary or might conflict with Prettier.",
@@ -23,7 +23,7 @@
23
23
  "prettier"
24
24
  ],
25
25
  "scripts": {
26
- "doctoc": "doctoc README.md && replace \"\\[(\\[[\\w-]+\\])\\]\" \"\\$1\" README.md",
26
+ "doctoc": "doctoc README.md && replace \"\\[(\\[[\\w/-]+\\])\\]\" \"\\$1\" README.md",
27
27
  "test:lint": "eslint .",
28
28
  "test:lint-verify-fail": "eslint \"test-lint/*.{js,vue}\" --config .eslintrc.base.js --format json",
29
29
  "test:lint-rules": "eslint index.js --config test-config/.eslintrc.js --format json",
package/vue.js CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  module.exports = {
4
4
  rules: {
5
+ "vue/html-self-closing": 0,
6
+
5
7
  "vue/html-closing-bracket-newline": "off",
6
8
  "vue/html-closing-bracket-spacing": "off",
7
9
  "vue/html-end-tags": "off",