immosquare-cleaner 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/immosquare-cleaner/version.rb +1 -1
  3. data/lib/immosquare-cleaner.rb +3 -2
  4. data/linters/eslintrc.json +54 -27
  5. data/package.json +7 -8
  6. metadata +30 -69
  7. data/node_modules/eslint-plugin-jsonc/LICENSE +0 -21
  8. data/node_modules/eslint-plugin-jsonc/README.md +0 -279
  9. data/node_modules/eslint-plugin-jsonc/conf/eslint-all.js +0 -11
  10. data/node_modules/eslint-plugin-jsonc/conf/eslint-recommended.js +0 -13
  11. data/node_modules/eslint-plugin-jsonc/conf/rules.js +0 -10
  12. data/node_modules/eslint-plugin-jsonc/dist/configs/all.js +0 -18
  13. data/node_modules/eslint-plugin-jsonc/dist/configs/auto-config.js +0 -13
  14. data/node_modules/eslint-plugin-jsonc/dist/configs/base.js +0 -15
  15. data/node_modules/eslint-plugin-jsonc/dist/configs/prettier.js +0 -26
  16. data/node_modules/eslint-plugin-jsonc/dist/configs/recommended-with-json.js +0 -41
  17. data/node_modules/eslint-plugin-jsonc/dist/configs/recommended-with-json5.js +0 -30
  18. data/node_modules/eslint-plugin-jsonc/dist/configs/recommended-with-jsonc.js +0 -39
  19. data/node_modules/eslint-plugin-jsonc/dist/index.js +0 -68
  20. data/node_modules/eslint-plugin-jsonc/dist/meta.js +0 -5
  21. data/node_modules/eslint-plugin-jsonc/dist/rules/array-bracket-newline.js +0 -23
  22. data/node_modules/eslint-plugin-jsonc/dist/rules/array-bracket-spacing.js +0 -23
  23. data/node_modules/eslint-plugin-jsonc/dist/rules/array-element-newline.js +0 -23
  24. data/node_modules/eslint-plugin-jsonc/dist/rules/auto.js +0 -66
  25. data/node_modules/eslint-plugin-jsonc/dist/rules/comma-dangle.js +0 -27
  26. data/node_modules/eslint-plugin-jsonc/dist/rules/comma-style.js +0 -23
  27. data/node_modules/eslint-plugin-jsonc/dist/rules/indent.js +0 -23
  28. data/node_modules/eslint-plugin-jsonc/dist/rules/key-name-casing.js +0 -94
  29. data/node_modules/eslint-plugin-jsonc/dist/rules/key-spacing.js +0 -23
  30. data/node_modules/eslint-plugin-jsonc/dist/rules/no-bigint-literals.js +0 -33
  31. data/node_modules/eslint-plugin-jsonc/dist/rules/no-binary-expression.js +0 -38
  32. data/node_modules/eslint-plugin-jsonc/dist/rules/no-binary-numeric-literals.js +0 -39
  33. data/node_modules/eslint-plugin-jsonc/dist/rules/no-comments.js +0 -34
  34. data/node_modules/eslint-plugin-jsonc/dist/rules/no-dupe-keys.js +0 -23
  35. data/node_modules/eslint-plugin-jsonc/dist/rules/no-escape-sequence-in-identifier.js +0 -57
  36. data/node_modules/eslint-plugin-jsonc/dist/rules/no-floating-decimal.js +0 -23
  37. data/node_modules/eslint-plugin-jsonc/dist/rules/no-hexadecimal-numeric-literals.js +0 -39
  38. data/node_modules/eslint-plugin-jsonc/dist/rules/no-infinity.js +0 -37
  39. data/node_modules/eslint-plugin-jsonc/dist/rules/no-irregular-whitespace.js +0 -23
  40. data/node_modules/eslint-plugin-jsonc/dist/rules/no-multi-str.js +0 -23
  41. data/node_modules/eslint-plugin-jsonc/dist/rules/no-nan.js +0 -37
  42. data/node_modules/eslint-plugin-jsonc/dist/rules/no-number-props.js +0 -41
  43. data/node_modules/eslint-plugin-jsonc/dist/rules/no-numeric-separators.js +0 -42
  44. data/node_modules/eslint-plugin-jsonc/dist/rules/no-octal-escape.js +0 -23
  45. data/node_modules/eslint-plugin-jsonc/dist/rules/no-octal-numeric-literals.js +0 -39
  46. data/node_modules/eslint-plugin-jsonc/dist/rules/no-octal.js +0 -23
  47. data/node_modules/eslint-plugin-jsonc/dist/rules/no-parenthesized.js +0 -70
  48. data/node_modules/eslint-plugin-jsonc/dist/rules/no-plus-sign.js +0 -39
  49. data/node_modules/eslint-plugin-jsonc/dist/rules/no-regexp-literals.js +0 -33
  50. data/node_modules/eslint-plugin-jsonc/dist/rules/no-sparse-arrays.js +0 -23
  51. data/node_modules/eslint-plugin-jsonc/dist/rules/no-template-literals.js +0 -36
  52. data/node_modules/eslint-plugin-jsonc/dist/rules/no-undefined-value.js +0 -35
  53. data/node_modules/eslint-plugin-jsonc/dist/rules/no-unicode-codepoint-escapes.js +0 -73
  54. data/node_modules/eslint-plugin-jsonc/dist/rules/no-useless-escape.js +0 -23
  55. data/node_modules/eslint-plugin-jsonc/dist/rules/object-curly-newline.js +0 -23
  56. data/node_modules/eslint-plugin-jsonc/dist/rules/object-curly-spacing.js +0 -23
  57. data/node_modules/eslint-plugin-jsonc/dist/rules/object-property-newline.js +0 -23
  58. data/node_modules/eslint-plugin-jsonc/dist/rules/quote-props.js +0 -27
  59. data/node_modules/eslint-plugin-jsonc/dist/rules/quotes.js +0 -27
  60. data/node_modules/eslint-plugin-jsonc/dist/rules/sort-array-values.js +0 -371
  61. data/node_modules/eslint-plugin-jsonc/dist/rules/sort-keys.js +0 -413
  62. data/node_modules/eslint-plugin-jsonc/dist/rules/space-unary-ops.js +0 -23
  63. data/node_modules/eslint-plugin-jsonc/dist/rules/valid-json-number.js +0 -138
  64. data/node_modules/eslint-plugin-jsonc/dist/rules/vue-custom-block/no-parsing-error.js +0 -86
  65. data/node_modules/eslint-plugin-jsonc/dist/types.js +0 -2
  66. data/node_modules/eslint-plugin-jsonc/dist/utils/casing.js +0 -134
  67. data/node_modules/eslint-plugin-jsonc/dist/utils/get-auto-jsonc-rules-config.js +0 -97
  68. data/node_modules/eslint-plugin-jsonc/dist/utils/index.js +0 -121
  69. data/node_modules/eslint-plugin-jsonc/dist/utils/rules.js +0 -96
  70. data/node_modules/eslint-plugin-jsonc/index.d.ts +0 -364
  71. data/node_modules/eslint-plugin-jsonc/package.json +0 -123
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98bc0c5d08586d949016612f1b71710b03b39a61bdcc58cdb2f8b50f50ef7267
4
- data.tar.gz: a79fa8ac332aae164826244e4f9c29cb87fcf7805139ae86935e95826630e2bd
3
+ metadata.gz: 50795a36ff8dc13390b41e0b9dd90bfc022369bee4e16f42d143e913340fbbb1
4
+ data.tar.gz: 995716de9e442829586399ad171d12090fe78a343f6c4085318074c321665a36
5
5
  SHA512:
6
- metadata.gz: 05b155d7be55971a077c178fd654b8b873ce99679ae84752a24943b928601ef2c2418fb7009f71717f070438f4fe82d292410a93c57be4a31cc4946e7357965d
7
- data.tar.gz: eced9939a2eac63dd18dfd7fbce06bf641459bd78f984055de86d79a410445fb31f7d8fb001d72b89be84208fd9b410f912c342282a3b648cc1a67b75d1feac8
6
+ metadata.gz: d80eac3c3314a34b279a1fe3c2ede81ec840b919cbc22ffc7fa3266f234a860b46d0651a16f59b03a148841c623dde689a1d87e272934a0d96ad3c3401c5e486
7
+ data.tar.gz: 1ce219e30239ad611e26c3dff48860bdfcbb7fd3024501fcde44733733d1835de09b8943425cf94ff896b7c54f32a3138c45cb27254026f27ea6132a24aa462d
@@ -1,3 +1,3 @@
1
1
  module ImmosquareCleaner
2
- VERSION = "0.1.9".freeze
2
+ VERSION = "0.1.10".freeze
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require "English"
2
- require "neatjson"
2
+ require "immosquare-yaml"
3
+ require "immosquare-extensions"
3
4
  require_relative "immosquare-cleaner/configuration"
4
5
  require_relative "immosquare-cleaner/railtie" if defined?(Rails)
5
6
 
@@ -84,7 +85,7 @@ module ImmosquareCleaner
84
85
  if file_path.end_with?(".json")
85
86
  json_str = File.read(file_path)
86
87
  parsed_data = JSON.parse(json_str)
87
- formated = JSON.neat_generate(parsed_data, :aligned => true)
88
+ formated = parsed_data.to_beautiful_json
88
89
  File.write(file_path, formated)
89
90
  normalize_last_line(file_path)
90
91
  return
@@ -1,30 +1,57 @@
1
1
  {
2
- "env" :{"browser":true,"es2021":true},
3
- "ignorePatterns":["package.json"],
4
- "extends" :["airbnb-base","plugin:jsonc/recommended-with-jsonc"],
5
- "overrides" :[],
6
- "parserOptions" :{"ecmaVersion":"latest","sourceType":"module"},
7
- "rules" :{
8
- "quotes" :[2,"double"],
9
- "semi" :[2,"never"],
10
- "camelcase" :0,
11
- "no-console" :0,
12
- "no-restricted-globals" :0,
13
- "no-multi-spaces" :0,
14
- "no-undef" :0,
15
- "radix" :0,
16
- "key-spacing" :[2,{"align":"value"}],
17
- "max-len" :0,
18
- "no-unused-expressions" :0,
19
- "padded-blocks" :0,
20
- "no-multiple-empty-lines":0,
21
- "default-case" :0,
22
- "no-alert" :0,
23
- "no-lonely-if" :0,
24
- "no-nested-ternary" :0,
25
- "no-param-reassign" :["error",{"props":false}],
26
- "comma-dangle" :["error","never"],
27
- "jsonc/auto" :2,
28
- "jsonc/indent" :["error",2,{}]
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true
5
+ },
6
+ "ignorePatterns": [
7
+ "package.json"
8
+ ],
9
+ "extends": [
10
+ "airbnb-base"
11
+ ],
12
+ "overrides": [],
13
+ "parserOptions": {
14
+ "ecmaVersion": "latest",
15
+ "sourceType": "module"
16
+ },
17
+ "rules": {
18
+ "quotes": [
19
+ 2,
20
+ "double"
21
+ ],
22
+ "semi": [
23
+ 2,
24
+ "never"
25
+ ],
26
+ "camelcase": 0,
27
+ "no-console": 0,
28
+ "no-restricted-globals": 0,
29
+ "no-multi-spaces": 0,
30
+ "no-undef": 0,
31
+ "radix": 0,
32
+ "key-spacing": [
33
+ 2,
34
+ {
35
+ "align": "value"
36
+ }
37
+ ],
38
+ "max-len": 0,
39
+ "no-unused-expressions": 0,
40
+ "padded-blocks": 0,
41
+ "no-multiple-empty-lines": 0,
42
+ "default-case": 0,
43
+ "no-alert": 0,
44
+ "no-lonely-if": 0,
45
+ "no-nested-ternary": 0,
46
+ "no-param-reassign": [
47
+ "error",
48
+ {
49
+ "props": false
50
+ }
51
+ ],
52
+ "comma-dangle": [
53
+ "error",
54
+ "never"
55
+ ]
29
56
  }
30
57
  }
data/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
- "name" :"immosquare-cleaner",
3
- "private" :true,
4
- "dependencies":{
5
- "eslint" :"^8.50.0",
6
- "prettier" :"^3.0.3",
7
- "eslint-config-airbnb-base":"^15.0.0",
8
- "eslint-plugin-import" :"^2.28.1",
9
- "eslint-plugin-jsonc" :"^2.9.0"
2
+ "name": "immosquare-cleaner",
3
+ "private": true,
4
+ "dependencies": {
5
+ "eslint": "^8.50.0",
6
+ "eslint-config-airbnb-base": "^15.0.0",
7
+ "eslint-plugin-import": "^2.28.1",
8
+ "prettier": "^3.0.3"
10
9
  }
11
10
  }
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-29 00:00:00.000000000 Z
11
+ date: 2023-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: erb_lint
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,12 +53,15 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '1'
41
55
  - !ruby/object:Gem::Dependency
42
- name: immosquare-yaml
56
+ name: immosquare-extensions
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.1.5
48
65
  type: :runtime
49
66
  prerelease: false
50
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,13 +69,19 @@ dependencies:
52
69
  - - "~>"
53
70
  - !ruby/object:Gem::Version
54
71
  version: '0'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.1.5
55
75
  - !ruby/object:Gem::Dependency
56
- name: neatjson
76
+ name: immosquare-yaml
57
77
  requirement: !ruby/object:Gem::Requirement
58
78
  requirements:
59
79
  - - "~>"
60
80
  - !ruby/object:Gem::Version
61
81
  version: '0'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 0.1.16
62
85
  type: :runtime
63
86
  prerelease: false
64
87
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,6 +89,9 @@ dependencies:
66
89
  - - "~>"
67
90
  - !ruby/object:Gem::Version
68
91
  version: '0'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 0.1.16
69
95
  description: Immosquare-cleaner streamlines Rails applications by running tools like
70
96
  RuboCop, ERBLint, Stylelint and more. It ensures code quality, readability, and
71
97
  consistency across the application.
@@ -2602,71 +2628,6 @@ files:
2602
2628
  - node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js
2603
2629
  - node_modules/eslint-plugin-import/node_modules/doctrine/package.json
2604
2630
  - node_modules/eslint-plugin-import/package.json
2605
- - node_modules/eslint-plugin-jsonc/LICENSE
2606
- - node_modules/eslint-plugin-jsonc/README.md
2607
- - node_modules/eslint-plugin-jsonc/conf/eslint-all.js
2608
- - node_modules/eslint-plugin-jsonc/conf/eslint-recommended.js
2609
- - node_modules/eslint-plugin-jsonc/conf/rules.js
2610
- - node_modules/eslint-plugin-jsonc/dist/configs/all.js
2611
- - node_modules/eslint-plugin-jsonc/dist/configs/auto-config.js
2612
- - node_modules/eslint-plugin-jsonc/dist/configs/base.js
2613
- - node_modules/eslint-plugin-jsonc/dist/configs/prettier.js
2614
- - node_modules/eslint-plugin-jsonc/dist/configs/recommended-with-json.js
2615
- - node_modules/eslint-plugin-jsonc/dist/configs/recommended-with-json5.js
2616
- - node_modules/eslint-plugin-jsonc/dist/configs/recommended-with-jsonc.js
2617
- - node_modules/eslint-plugin-jsonc/dist/index.js
2618
- - node_modules/eslint-plugin-jsonc/dist/meta.js
2619
- - node_modules/eslint-plugin-jsonc/dist/rules/array-bracket-newline.js
2620
- - node_modules/eslint-plugin-jsonc/dist/rules/array-bracket-spacing.js
2621
- - node_modules/eslint-plugin-jsonc/dist/rules/array-element-newline.js
2622
- - node_modules/eslint-plugin-jsonc/dist/rules/auto.js
2623
- - node_modules/eslint-plugin-jsonc/dist/rules/comma-dangle.js
2624
- - node_modules/eslint-plugin-jsonc/dist/rules/comma-style.js
2625
- - node_modules/eslint-plugin-jsonc/dist/rules/indent.js
2626
- - node_modules/eslint-plugin-jsonc/dist/rules/key-name-casing.js
2627
- - node_modules/eslint-plugin-jsonc/dist/rules/key-spacing.js
2628
- - node_modules/eslint-plugin-jsonc/dist/rules/no-bigint-literals.js
2629
- - node_modules/eslint-plugin-jsonc/dist/rules/no-binary-expression.js
2630
- - node_modules/eslint-plugin-jsonc/dist/rules/no-binary-numeric-literals.js
2631
- - node_modules/eslint-plugin-jsonc/dist/rules/no-comments.js
2632
- - node_modules/eslint-plugin-jsonc/dist/rules/no-dupe-keys.js
2633
- - node_modules/eslint-plugin-jsonc/dist/rules/no-escape-sequence-in-identifier.js
2634
- - node_modules/eslint-plugin-jsonc/dist/rules/no-floating-decimal.js
2635
- - node_modules/eslint-plugin-jsonc/dist/rules/no-hexadecimal-numeric-literals.js
2636
- - node_modules/eslint-plugin-jsonc/dist/rules/no-infinity.js
2637
- - node_modules/eslint-plugin-jsonc/dist/rules/no-irregular-whitespace.js
2638
- - node_modules/eslint-plugin-jsonc/dist/rules/no-multi-str.js
2639
- - node_modules/eslint-plugin-jsonc/dist/rules/no-nan.js
2640
- - node_modules/eslint-plugin-jsonc/dist/rules/no-number-props.js
2641
- - node_modules/eslint-plugin-jsonc/dist/rules/no-numeric-separators.js
2642
- - node_modules/eslint-plugin-jsonc/dist/rules/no-octal-escape.js
2643
- - node_modules/eslint-plugin-jsonc/dist/rules/no-octal-numeric-literals.js
2644
- - node_modules/eslint-plugin-jsonc/dist/rules/no-octal.js
2645
- - node_modules/eslint-plugin-jsonc/dist/rules/no-parenthesized.js
2646
- - node_modules/eslint-plugin-jsonc/dist/rules/no-plus-sign.js
2647
- - node_modules/eslint-plugin-jsonc/dist/rules/no-regexp-literals.js
2648
- - node_modules/eslint-plugin-jsonc/dist/rules/no-sparse-arrays.js
2649
- - node_modules/eslint-plugin-jsonc/dist/rules/no-template-literals.js
2650
- - node_modules/eslint-plugin-jsonc/dist/rules/no-undefined-value.js
2651
- - node_modules/eslint-plugin-jsonc/dist/rules/no-unicode-codepoint-escapes.js
2652
- - node_modules/eslint-plugin-jsonc/dist/rules/no-useless-escape.js
2653
- - node_modules/eslint-plugin-jsonc/dist/rules/object-curly-newline.js
2654
- - node_modules/eslint-plugin-jsonc/dist/rules/object-curly-spacing.js
2655
- - node_modules/eslint-plugin-jsonc/dist/rules/object-property-newline.js
2656
- - node_modules/eslint-plugin-jsonc/dist/rules/quote-props.js
2657
- - node_modules/eslint-plugin-jsonc/dist/rules/quotes.js
2658
- - node_modules/eslint-plugin-jsonc/dist/rules/sort-array-values.js
2659
- - node_modules/eslint-plugin-jsonc/dist/rules/sort-keys.js
2660
- - node_modules/eslint-plugin-jsonc/dist/rules/space-unary-ops.js
2661
- - node_modules/eslint-plugin-jsonc/dist/rules/valid-json-number.js
2662
- - node_modules/eslint-plugin-jsonc/dist/rules/vue-custom-block/no-parsing-error.js
2663
- - node_modules/eslint-plugin-jsonc/dist/types.js
2664
- - node_modules/eslint-plugin-jsonc/dist/utils/casing.js
2665
- - node_modules/eslint-plugin-jsonc/dist/utils/get-auto-jsonc-rules-config.js
2666
- - node_modules/eslint-plugin-jsonc/dist/utils/index.js
2667
- - node_modules/eslint-plugin-jsonc/dist/utils/rules.js
2668
- - node_modules/eslint-plugin-jsonc/index.d.ts
2669
- - node_modules/eslint-plugin-jsonc/package.json
2670
2631
  - node_modules/eslint-scope/LICENSE
2671
2632
  - node_modules/eslint-scope/README.md
2672
2633
  - node_modules/eslint-scope/dist/eslint-scope.cjs
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Yosuke Ota
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,279 +0,0 @@
1
- # Introduction
2
-
3
- [eslint-plugin-jsonc](https://www.npmjs.com/package/eslint-plugin-jsonc) is ESLint plugin for [JSON], [JSONC] and [JSON5] files.
4
-
5
- [![NPM license](https://img.shields.io/npm/l/eslint-plugin-jsonc.svg)](https://www.npmjs.com/package/eslint-plugin-jsonc)
6
- [![NPM version](https://img.shields.io/npm/v/eslint-plugin-jsonc.svg)](https://www.npmjs.com/package/eslint-plugin-jsonc)
7
- [![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads&colorB=green&suffix=/day&query=$.downloads&uri=https://api.npmjs.org//downloads/point/last-day/eslint-plugin-jsonc&maxAge=3600)](http://www.npmtrends.com/eslint-plugin-jsonc)
8
- [![NPM downloads](https://img.shields.io/npm/dw/eslint-plugin-jsonc.svg)](http://www.npmtrends.com/eslint-plugin-jsonc)
9
- [![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-jsonc.svg)](http://www.npmtrends.com/eslint-plugin-jsonc)
10
- [![NPM downloads](https://img.shields.io/npm/dy/eslint-plugin-jsonc.svg)](http://www.npmtrends.com/eslint-plugin-jsonc)
11
- [![NPM downloads](https://img.shields.io/npm/dt/eslint-plugin-jsonc.svg)](http://www.npmtrends.com/eslint-plugin-jsonc)
12
- [![Build Status](https://github.com/ota-meshi/eslint-plugin-jsonc/workflows/CI/badge.svg?branch=master)](https://github.com/ota-meshi/eslint-plugin-jsonc/actions?query=workflow%3ACI)
13
- [![Coverage Status](https://coveralls.io/repos/github/ota-meshi/eslint-plugin-jsonc/badge.svg?branch=master)](https://coveralls.io/github/ota-meshi/eslint-plugin-jsonc?branch=master)
14
-
15
- ## :name_badge: Features
16
-
17
- This ESLint plugin provides linting rules relate to better ways to help you avoid problems when using [JSON], [JSONC] and [JSON5].
18
-
19
- - You can use ESLint to lint [JSON].
20
- - You can apply rules similar to the rules you use for JavaScript to JSON using the [`"jsonc/auto"`](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/auto.html) rule provided by this plugin.
21
- - You can choose the appropriate config provided by this plugin depending on whether you are using [JSON], [JSONC] or [JSON5].
22
- - Supports [Vue SFC](https://vue-loader.vuejs.org/spec.html) custom blocks such as `<i18n>`.
23
- Requirements `vue-eslint-parser` v7.3.0 and above.
24
- - Supports ESLint directives. e.g. `// eslint-disable-next-line`
25
- - You can check your code in real-time using the ESLint editor integrations.
26
-
27
- You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-jsonc/playground/).
28
-
29
- ## :question: Why is it ESLint plugin?
30
-
31
- ESLint is a great linter for JavaScript.
32
- Since [JSON] is a subset of JavaScript, the same parser and rules can be applied to [JSON].
33
- Also, [JSONC] and [JSON5], which are variants of [JSON], are more similar to JavaScript than [JSON]. Applying a JavaScript linter to [JSON] is more rational than creating a JSON-specific linter.
34
-
35
- ### How does `eslint-plugin-jsonc` work?
36
-
37
- This plugin parses `.json` with its own parser, but this parser just converts AST parsed by `acorn` (It is used internally by the ESLint standard parser) into AST with another name. However, ASTs that do not exist in [JSON] and the superset of JSON syntaxes are reported as parsing errors. By converting the AST to another name, we prevent false positives from ESLint core rules.
38
- Moreover, You can do the same linting using the extended rules of the ESLint core rules provided by this plugin.
39
-
40
- The parser package used by this plugin is [jsonc-eslint-parser].
41
-
42
- ## :question: How is it different from other JSON plugins?
43
-
44
- ### Plugins that do not use AST
45
-
46
- e.g. [eslint-plugin-json](https://www.npmjs.com/package/eslint-plugin-json)
47
-
48
- These plugins use the processor to parse and return the results independently, without providing the ESLint engine with AST and source code text.
49
-
50
- Plugins don't provide AST, so you can't use directive comments (e.g. `/* eslint-disable */`).
51
- Plugins don't provide source code text, so you can't use it with plugins and rules that use text (e.g. [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier), [eol-last](https://eslint.org/docs/rules/eol-last)).
52
- Also, most plugins don't support JSON5.
53
-
54
- **eslint-plugin-jsonc** works by providing AST and source code text to ESLint.
55
-
56
- ### Plugins that use the same AST as JavaScript
57
-
58
- e.g. [eslint-plugin-json-files](https://www.npmjs.com/package/eslint-plugin-json-files), [eslint-plugin-json-es](https://www.npmjs.com/package/eslint-plugin-json-es)
59
-
60
- These plugins use the same AST as JavaScript for linting.
61
-
62
- Since the plugin uses the same AST as JavaScript, it may not report syntax that is not available in JSON (e.g. `1 + 1`, `(42)`). Also, ESLint core rules and other plugin rules can false positives (e.g. [quote-props](https://eslint.org/docs/rules/quote-props) rule reports quote on keys), which can complicate the your configuration.
63
-
64
- The AST used by **eslint-plugin-jsonc** is similar to JavaScript AST, but with a different node name. This will prevent false positives. This means that it can be easily used in combination with other plugins.
65
-
66
- <!--DOCS_IGNORE_START-->
67
-
68
- ## :book: Documentation
69
-
70
- See [documents](https://ota-meshi.github.io/eslint-plugin-jsonc/).
71
-
72
- ## :cd: Installation
73
-
74
- ```bash
75
- npm install --save-dev eslint eslint-plugin-jsonc
76
- ```
77
-
78
- > **Requirements**
79
- >
80
- > - ESLint v6.0.0 and above
81
- > - Node.js v12.22.x, v14.17.x, v16.x and above
82
-
83
- <!--DOCS_IGNORE_END-->
84
-
85
- ## :book: Usage
86
-
87
- <!--USAGE_SECTION_START-->
88
- <!--USAGE_GUIDE_START-->
89
-
90
- ### Configuration
91
-
92
- Use `.eslintrc.*` file to configure rules. See also: [https://eslint.org/docs/user-guide/configuring](https://eslint.org/docs/user-guide/configuring).
93
-
94
- Example **.eslintrc.js**:
95
-
96
- ```js
97
- module.exports = {
98
- extends: [
99
- // add more generic rulesets here, such as:
100
- // 'eslint:recommended',
101
- "plugin:jsonc/recommended-with-jsonc",
102
- ],
103
- rules: {
104
- // override/add rules settings here, such as:
105
- // 'jsonc/rule-name': 'error'
106
- },
107
- };
108
- ```
109
-
110
- This plugin provides configs:
111
-
112
- - `plugin:jsonc/base` ... Configuration to enable correct JSON parsing.
113
- - `plugin:jsonc/recommended-with-json` ... Recommended configuration for JSON.
114
- - `plugin:jsonc/recommended-with-jsonc` ... Recommended configuration for JSONC.
115
- - `plugin:jsonc/recommended-with-json5` ... Recommended configuration for JSON5.
116
- - `plugin:jsonc/prettier` ... Turn off rules that may conflict with [Prettier](https://prettier.io/).
117
- - `plugin:jsonc/all` ... Enables all rules. It's meant for testing, not for production use because it changes with every minor and major version of the plugin. Use it at your own risk.
118
-
119
- This plugin will parse `.json`, `.jsonc` and `.json5` by default using the configuration provided by the plugin (unless you already have a parser configured - see below).
120
-
121
- See [the rule list](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/) to get the `rules` that this plugin provides.
122
-
123
- #### Parser Configuration
124
-
125
- If you have already specified a parser in your `.eslintrc`, you will also need to manually configure the parser for JSON files (your parser config takes priority over that defined by `extends` shared configs).
126
-
127
- For example, if you are using the `"@babel/eslint-parser"`, configure it as follows:
128
-
129
- ```js
130
- module.exports = {
131
- // ...
132
- extends: ["plugin:jsonc/recommended-with-jsonc"],
133
- // ...
134
- parser: "@babel/eslint-parser",
135
- // Add an `overrides` section to add a parser configuration for json.
136
- overrides: [
137
- {
138
- files: ["*.json", "*.json5", "*.jsonc"],
139
- parser: "jsonc-eslint-parser",
140
- },
141
- ],
142
- // ...
143
- };
144
- ```
145
-
146
- ## :computer: Editor Integrations
147
-
148
- ### Visual Studio Code
149
-
150
- Use the [dbaeumer.vscode-eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension that Microsoft provides officially.
151
-
152
- You have to configure the `eslint.validate` option of the extension to check `.json` files, because the extension targets only `*.js` or `*.jsx` files by default.
153
-
154
- Example **.vscode/settings.json**:
155
-
156
- ```json
157
- {
158
- "eslint.validate": ["javascript", "javascriptreact", "json", "jsonc", "json5"]
159
- }
160
- ```
161
-
162
- <!--USAGE_GUIDE_END-->
163
- <!--USAGE_SECTION_END-->
164
-
165
- ## :white_check_mark: Rules
166
-
167
- <!--RULES_SECTION_START-->
168
-
169
- The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below.
170
- The rules with the following star :star: are included in the config.
171
-
172
- <!--RULES_TABLE_START-->
173
-
174
- ### JSONC Rules
175
-
176
- | Rule ID | Description | Fixable | JSON | JSONC | JSON5 |
177
- |:--------|:------------|:-------:|:----:|:-----:|:-----:|
178
- | [jsonc/auto](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/auto.html) | apply jsonc rules similar to your configured ESLint core rules | :wrench: | | | |
179
- | [jsonc/key-name-casing](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/key-name-casing.html) | enforce naming convention to property key names | | | | |
180
- | [jsonc/no-bigint-literals](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-bigint-literals.html) | disallow BigInt literals | | :star: | :star: | :star: |
181
- | [jsonc/no-binary-expression](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-binary-expression.html) | disallow binary expression | :wrench: | :star: | :star: | :star: |
182
- | [jsonc/no-binary-numeric-literals](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-binary-numeric-literals.html) | disallow binary numeric literals | :wrench: | :star: | :star: | :star: |
183
- | [jsonc/no-comments](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-comments.html) | disallow comments | | :star: | | |
184
- | [jsonc/no-escape-sequence-in-identifier](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-escape-sequence-in-identifier.html) | disallow escape sequences in identifiers. | :wrench: | :star: | :star: | :star: |
185
- | [jsonc/no-hexadecimal-numeric-literals](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-hexadecimal-numeric-literals.html) | disallow hexadecimal numeric literals | :wrench: | :star: | :star: | |
186
- | [jsonc/no-infinity](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-infinity.html) | disallow Infinity | | :star: | :star: | |
187
- | [jsonc/no-nan](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-nan.html) | disallow NaN | | :star: | :star: | |
188
- | [jsonc/no-number-props](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-number-props.html) | disallow number property keys | :wrench: | :star: | :star: | :star: |
189
- | [jsonc/no-numeric-separators](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-numeric-separators.html) | disallow numeric separators | :wrench: | :star: | :star: | :star: |
190
- | [jsonc/no-octal-numeric-literals](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-octal-numeric-literals.html) | disallow octal numeric literals | :wrench: | :star: | :star: | :star: |
191
- | [jsonc/no-parenthesized](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-parenthesized.html) | disallow parentheses around the expression | :wrench: | :star: | :star: | :star: |
192
- | [jsonc/no-plus-sign](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-plus-sign.html) | disallow plus sign | :wrench: | :star: | :star: | |
193
- | [jsonc/no-regexp-literals](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-regexp-literals.html) | disallow RegExp literals | | :star: | :star: | :star: |
194
- | [jsonc/no-template-literals](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-template-literals.html) | disallow template literals | :wrench: | :star: | :star: | :star: |
195
- | [jsonc/no-undefined-value](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-undefined-value.html) | disallow `undefined` | | :star: | :star: | :star: |
196
- | [jsonc/no-unicode-codepoint-escapes](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-unicode-codepoint-escapes.html) | disallow Unicode code point escape sequences. | :wrench: | :star: | :star: | :star: |
197
- | [jsonc/sort-array-values](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/sort-array-values.html) | require array values to be sorted | :wrench: | | | |
198
- | [jsonc/sort-keys](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/sort-keys.html) | require object keys to be sorted | :wrench: | | | |
199
- | [jsonc/valid-json-number](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/valid-json-number.html) | disallow invalid number for JSON | :wrench: | :star: | :star: | |
200
- | [jsonc/vue-custom-block/no-parsing-error](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/vue-custom-block/no-parsing-error.html) | disallow parsing errors in Vue custom blocks | | :star: | :star: | :star: |
201
-
202
- ### Extension Rules
203
-
204
- | Rule ID | Description | Fixable | JSON | JSONC | JSON5 |
205
- |:--------|:------------|:-------:|:----:|:-----:|:-----:|
206
- | [jsonc/array-bracket-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-newline.html) | enforce line breaks after opening and before closing array brackets | :wrench: | | | |
207
- | [jsonc/array-bracket-spacing](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-bracket-spacing.html) | disallow or enforce spaces inside of brackets | :wrench: | | | |
208
- | [jsonc/array-element-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/array-element-newline.html) | enforce line breaks between array elements | :wrench: | | | |
209
- | [jsonc/comma-dangle](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-dangle.html) | require or disallow trailing commas | :wrench: | :star: | | |
210
- | [jsonc/comma-style](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/comma-style.html) | enforce consistent comma style | :wrench: | | | |
211
- | [jsonc/indent](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/indent.html) | enforce consistent indentation | :wrench: | | | |
212
- | [jsonc/key-spacing](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/key-spacing.html) | enforce consistent spacing between keys and values in object literal properties | :wrench: | | | |
213
- | [jsonc/no-dupe-keys](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-dupe-keys.html) | disallow duplicate keys in object literals | | :star: | :star: | :star: |
214
- | [jsonc/no-floating-decimal](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-floating-decimal.html) | disallow leading or trailing decimal points in numeric literals | :wrench: | :star: | :star: | |
215
- | [jsonc/no-irregular-whitespace](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-irregular-whitespace.html) | disallow irregular whitespace | | | | |
216
- | [jsonc/no-multi-str](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-multi-str.html) | disallow multiline strings | | :star: | :star: | |
217
- | [jsonc/no-octal-escape](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-octal-escape.html) | disallow octal escape sequences in string literals | | | | |
218
- | [jsonc/no-octal](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-octal.html) | disallow legacy octal literals | | :star: | :star: | :star: |
219
- | [jsonc/no-sparse-arrays](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-sparse-arrays.html) | disallow sparse arrays | | :star: | :star: | :star: |
220
- | [jsonc/no-useless-escape](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-useless-escape.html) | disallow unnecessary escape usage | | :star: | :star: | :star: |
221
- | [jsonc/object-curly-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/object-curly-newline.html) | enforce consistent line breaks inside braces | :wrench: | | | |
222
- | [jsonc/object-curly-spacing](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/object-curly-spacing.html) | enforce consistent spacing inside braces | :wrench: | | | |
223
- | [jsonc/object-property-newline](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/object-property-newline.html) | enforce placing object properties on separate lines | :wrench: | | | |
224
- | [jsonc/quote-props](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/quote-props.html) | require quotes around object literal property names | :wrench: | :star: | :star: | |
225
- | [jsonc/quotes](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/quotes.html) | enforce use of double or single quotes | :wrench: | :star: | :star: | |
226
- | [jsonc/space-unary-ops](https://ota-meshi.github.io/eslint-plugin-jsonc/rules/space-unary-ops.html) | disallow spaces after unary operators | :wrench: | :star: | :star: | :star: |
227
-
228
- <!--RULES_TABLE_END-->
229
- <!--RULES_SECTION_END-->
230
-
231
- ## :rocket: To Do More Verification
232
-
233
- ### Verify using JSON Schema
234
-
235
- You can verify using JSON Schema by checking and installing [eslint-plugin-json-schema-validator].
236
-
237
- ### Verify the [Vue I18n] message resource files
238
-
239
- You can verify the message files by checking and installing [@intlify/eslint-plugin-vue-i18n].
240
-
241
- <!--DOCS_IGNORE_START-->
242
-
243
- ## :traffic_light: Semantic Versioning Policy
244
-
245
- **eslint-plugin-jsonc** follows [Semantic Versioning](http://semver.org/) and [ESLint's Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy).
246
-
247
- ## :beers: Contributing
248
-
249
- Welcome contributing!
250
-
251
- Please use GitHub's Issues/PRs.
252
-
253
- ### Development Tools
254
-
255
- - `npm test` runs tests and measures coverage.
256
- - `npm run update` runs in order to update readme and recommended configuration.
257
-
258
- <!--DOCS_IGNORE_END-->
259
-
260
- ## :couple: Related Packages
261
-
262
- - [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) ... ESLint plugin for YAML.
263
- - [eslint-plugin-toml](https://github.com/ota-meshi/eslint-plugin-toml) ... ESLint plugin for TOML.
264
- - [eslint-plugin-json-schema-validator](https://github.com/ota-meshi/eslint-plugin-json-schema-validator) ... ESLint plugin that validates data using JSON Schema Validator.
265
- - [jsonc-eslint-parser](https://github.com/ota-meshi/jsonc-eslint-parser) ... JSON, JSONC and JSON5 parser for use with ESLint plugins.
266
- - [yaml-eslint-parser](https://github.com/ota-meshi/yaml-eslint-parser) ... YAML parser for use with ESLint plugins.
267
- - [toml-eslint-parser](https://github.com/ota-meshi/toml-eslint-parser) ... TOML parser for use with ESLint plugins.
268
-
269
- ## :lock: License
270
-
271
- See the [LICENSE](LICENSE) file for license rights and limitations (MIT).
272
-
273
- [json]: https://json.org/
274
- [jsonc]: https://github.com/microsoft/node-jsonc-parser
275
- [json5]: https://json5.org/
276
- [jsonc-eslint-parser]: https://github.com/ota-meshi/jsonc-eslint-parser
277
- [eslint-plugin-json-schema-validator]: https://github.com/ota-meshi/eslint-plugin-json-schema-validator
278
- [@intlify/eslint-plugin-vue-i18n]: https://github.com/intlify/eslint-plugin-vue-i18n
279
- [vue i18n]: https://github.com/intlify/vue-i18n-next
@@ -1,11 +0,0 @@
1
- // @ts-nocheck
2
- const getCoreRules = require("./rules");
3
-
4
- const allRules = {};
5
-
6
- for (const [ruleId, rule] of getCoreRules()) {
7
- if (!rule.meta.deprecated) {
8
- allRules[ruleId] = "error";
9
- }
10
- }
11
- module.exports = { rules: allRules };
@@ -1,13 +0,0 @@
1
- // @ts-nocheck
2
- const getCoreRules = require("./rules");
3
-
4
- const rules = {};
5
-
6
- for (const [ruleId, rule] of getCoreRules()) {
7
- if (rule.meta.docs.recommended && !rule.meta.deprecated) {
8
- rules[ruleId] = "error";
9
- }
10
- }
11
- module.exports = {
12
- rules,
13
- };
@@ -1,10 +0,0 @@
1
- // @ts-nocheck
2
- let ruleMap;
3
-
4
- /** Get all rules */
5
- module.exports = function getCoreRules() {
6
- if (ruleMap) {
7
- return ruleMap;
8
- }
9
- return (ruleMap = new (require("eslint").Linter)().getRules());
10
- };