@vinicunca/eslint-config 2.1.2 → 2.1.5

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/dist/index.cjs CHANGED
@@ -1793,7 +1793,6 @@ async function node() {
1793
1793
  }
1794
1794
 
1795
1795
  // src/configs/react.ts
1796
- var STR_PARENS_NEW_LINE = "parens-new-line";
1797
1796
  async function react(options = {}) {
1798
1797
  const {
1799
1798
  files = [GLOB_JSX, GLOB_TSX],
@@ -1841,57 +1840,17 @@ async function react(options = {}) {
1841
1840
  }],
1842
1841
  "react/destructuring-assignment": [ERROR, "always"],
1843
1842
  "react/jsx-boolean-value": [ERROR, NEVER, { always: [] }],
1844
- "react/jsx-child-element-spacing": OFF,
1845
- "react/jsx-closing-bracket-location": [ERROR, "line-aligned"],
1846
- "react/jsx-closing-tag-location": ERROR,
1847
- "react/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
1848
- "react/jsx-curly-newline": [ERROR, {
1849
- multiline: "consistent",
1850
- singleline: "consistent"
1851
- }],
1852
- "react/jsx-curly-spacing": [ERROR, {
1853
- children: true,
1854
- spacing: {
1855
- objectLiterals: NEVER
1856
- },
1857
- when: "always"
1858
- }],
1859
- "react/jsx-equals-spacing": [ERROR, NEVER],
1860
- "react/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
1861
- "react/jsx-indent": [ERROR, 2],
1862
- "react/jsx-indent-props": [ERROR, 2],
1863
1843
  "react/jsx-key": OFF,
1864
1844
  "react/jsx-max-depth": OFF,
1865
- "react/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
1866
- "react/jsx-newline": ERROR,
1867
1845
  "react/jsx-no-duplicate-props": [ERROR, { ignoreCase: true }],
1868
1846
  "react/jsx-no-literals": [OFF, { noStrings: true }],
1869
- "react/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
1870
1847
  "react/jsx-pascal-case": [ERROR, {
1871
1848
  allowAllCaps: true,
1872
1849
  ignore: []
1873
1850
  }],
1874
- "react/jsx-props-no-multi-spaces": ERROR,
1875
1851
  "react/jsx-sort-default-props": [OFF, {
1876
1852
  ignoreCase: true
1877
1853
  }],
1878
- // Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
1879
- "react/jsx-sort-props": [OFF],
1880
- "react/jsx-tag-spacing": [ERROR, {
1881
- afterOpening: NEVER,
1882
- beforeClosing: NEVER,
1883
- beforeSelfClosing: "always",
1884
- closingSlash: NEVER
1885
- }],
1886
- "react/jsx-wrap-multilines": [ERROR, {
1887
- arrow: STR_PARENS_NEW_LINE,
1888
- assignment: STR_PARENS_NEW_LINE,
1889
- condition: STR_PARENS_NEW_LINE,
1890
- declaration: STR_PARENS_NEW_LINE,
1891
- logical: STR_PARENS_NEW_LINE,
1892
- prop: STR_PARENS_NEW_LINE,
1893
- return: STR_PARENS_NEW_LINE
1894
- }],
1895
1854
  "react/no-danger": WARN,
1896
1855
  "react/no-unescaped-entities": OFF,
1897
1856
  "react/prop-types": OFF,
@@ -2121,6 +2080,7 @@ function sortTsconfig() {
2121
2080
  }
2122
2081
 
2123
2082
  // src/configs/stylistic.ts
2083
+ var STR_PARENS_NEW_LINE = "parens-new-line";
2124
2084
  var STYLISTIC_CONFIG_DEFAULTS = {
2125
2085
  indent: 2,
2126
2086
  jsx: true,
@@ -2163,6 +2123,46 @@ async function stylistic(options = {}) {
2163
2123
  "style/arrow-parens": [ERROR, ALWAYS],
2164
2124
  "style/brace-style": [ERROR],
2165
2125
  "style/func-call-spacing": [ERROR, NEVER],
2126
+ "style/jsx-child-element-spacing": OFF,
2127
+ "style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
2128
+ "style/jsx-closing-tag-location": ERROR,
2129
+ "style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
2130
+ "style/jsx-curly-newline": [ERROR, {
2131
+ multiline: "consistent",
2132
+ singleline: "consistent"
2133
+ }],
2134
+ "style/jsx-curly-spacing": [ERROR, {
2135
+ children: true,
2136
+ spacing: {
2137
+ objectLiterals: NEVER
2138
+ },
2139
+ when: "always"
2140
+ }],
2141
+ "style/jsx-equals-spacing": [ERROR, NEVER],
2142
+ "style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
2143
+ "style/jsx-indent": [ERROR, 2],
2144
+ "style/jsx-indent-props": [ERROR, 2],
2145
+ "style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
2146
+ "style/jsx-newline": ERROR,
2147
+ "style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
2148
+ "style/jsx-props-no-multi-spaces": ERROR,
2149
+ // Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
2150
+ "style/jsx-sort-props": [OFF],
2151
+ "style/jsx-tag-spacing": [ERROR, {
2152
+ afterOpening: NEVER,
2153
+ beforeClosing: NEVER,
2154
+ beforeSelfClosing: "always",
2155
+ closingSlash: NEVER
2156
+ }],
2157
+ "style/jsx-wrap-multilines": [ERROR, {
2158
+ arrow: STR_PARENS_NEW_LINE,
2159
+ assignment: STR_PARENS_NEW_LINE,
2160
+ condition: STR_PARENS_NEW_LINE,
2161
+ declaration: STR_PARENS_NEW_LINE,
2162
+ logical: STR_PARENS_NEW_LINE,
2163
+ prop: STR_PARENS_NEW_LINE,
2164
+ return: STR_PARENS_NEW_LINE
2165
+ }],
2166
2166
  "style/member-delimiter-style": [ERROR],
2167
2167
  "style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
2168
2168
  "style/object-curly-spacing": [ERROR, ALWAYS],
@@ -2247,6 +2247,8 @@ async function typescript(options = {}) {
2247
2247
  ...componentExts.map((ext) => `**/*.${ext}`)
2248
2248
  ];
2249
2249
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
2250
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2251
+ const isTypeAware = !!tsconfigPath;
2250
2252
  const typeAwareRules = {
2251
2253
  "dot-notation": OFF,
2252
2254
  "no-implied-eval": OFF,
@@ -2262,7 +2264,6 @@ async function typescript(options = {}) {
2262
2264
  "ts/restrict-plus-operands": ERROR,
2263
2265
  "ts/restrict-template-expressions": ERROR
2264
2266
  };
2265
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2266
2267
  const [
2267
2268
  pluginTs,
2268
2269
  parserTs
@@ -2270,29 +2271,41 @@ async function typescript(options = {}) {
2270
2271
  interopDefault(import("@typescript-eslint/eslint-plugin")),
2271
2272
  interopDefault(import("@typescript-eslint/parser"))
2272
2273
  ]);
2273
- return [
2274
- {
2275
- // Install the plugins without globs, so they can be configured separately.
2276
- name: "vinicunca:typescript:setup",
2277
- plugins: {
2278
- ts: pluginTs,
2279
- vinicunca: import_eslint_plugin_vinicunca.default
2280
- }
2281
- },
2282
- {
2283
- files,
2274
+ function makeParser({ files: files2, ignores: ignores2, typeAware }) {
2275
+ return {
2276
+ files: files2,
2277
+ ...ignores2 ? { ignores: ignores2 } : {},
2284
2278
  languageOptions: {
2285
2279
  parser: parserTs,
2286
2280
  parserOptions: {
2287
2281
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
2288
2282
  sourceType: "module",
2289
- ...tsconfigPath ? {
2283
+ ...typeAware ? {
2290
2284
  project: tsconfigPath,
2291
2285
  tsconfigRootDir: import_node_process.default.cwd()
2292
2286
  } : {},
2293
2287
  ...parserOptions
2294
2288
  }
2295
2289
  },
2290
+ name: `vinicunca:typescript:${typeAware ? "type-aware-parser" : "parser"}`
2291
+ };
2292
+ }
2293
+ return [
2294
+ {
2295
+ // Install the plugins without globs, so they can be configured separately.
2296
+ name: "vinicunca:typescript:setup",
2297
+ plugins: {
2298
+ ts: pluginTs,
2299
+ vinicunca: import_eslint_plugin_vinicunca.default
2300
+ }
2301
+ },
2302
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
2303
+ ...isTypeAware ? [
2304
+ makeParser({ files: filesTypeAware, typeAware: true }),
2305
+ makeParser({ files, ignores: filesTypeAware, typeAware: false })
2306
+ ] : [makeParser({ files, typeAware: false })],
2307
+ {
2308
+ files,
2296
2309
  name: "vinicunca:typescript:rules",
2297
2310
  rules: {
2298
2311
  ...renameRules(
package/dist/index.d.cts CHANGED
@@ -314,7 +314,7 @@ interface OptionsConfig extends OptionsComponentExts {
314
314
  *
315
315
  * @default true
316
316
  */
317
- stylistic?: StylisticConfig | boolean;
317
+ stylistic?: (StylisticConfig & OptionsOverrides) | boolean;
318
318
  /**
319
319
  * Enable test support.
320
320
  *
package/dist/index.d.ts CHANGED
@@ -314,7 +314,7 @@ interface OptionsConfig extends OptionsComponentExts {
314
314
  *
315
315
  * @default true
316
316
  */
317
- stylistic?: StylisticConfig | boolean;
317
+ stylistic?: (StylisticConfig & OptionsOverrides) | boolean;
318
318
  /**
319
319
  * Enable test support.
320
320
  *
package/dist/index.js CHANGED
@@ -1703,7 +1703,6 @@ async function node() {
1703
1703
  }
1704
1704
 
1705
1705
  // src/configs/react.ts
1706
- var STR_PARENS_NEW_LINE = "parens-new-line";
1707
1706
  async function react(options = {}) {
1708
1707
  const {
1709
1708
  files = [GLOB_JSX, GLOB_TSX],
@@ -1751,57 +1750,17 @@ async function react(options = {}) {
1751
1750
  }],
1752
1751
  "react/destructuring-assignment": [ERROR, "always"],
1753
1752
  "react/jsx-boolean-value": [ERROR, NEVER, { always: [] }],
1754
- "react/jsx-child-element-spacing": OFF,
1755
- "react/jsx-closing-bracket-location": [ERROR, "line-aligned"],
1756
- "react/jsx-closing-tag-location": ERROR,
1757
- "react/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
1758
- "react/jsx-curly-newline": [ERROR, {
1759
- multiline: "consistent",
1760
- singleline: "consistent"
1761
- }],
1762
- "react/jsx-curly-spacing": [ERROR, {
1763
- children: true,
1764
- spacing: {
1765
- objectLiterals: NEVER
1766
- },
1767
- when: "always"
1768
- }],
1769
- "react/jsx-equals-spacing": [ERROR, NEVER],
1770
- "react/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
1771
- "react/jsx-indent": [ERROR, 2],
1772
- "react/jsx-indent-props": [ERROR, 2],
1773
1753
  "react/jsx-key": OFF,
1774
1754
  "react/jsx-max-depth": OFF,
1775
- "react/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
1776
- "react/jsx-newline": ERROR,
1777
1755
  "react/jsx-no-duplicate-props": [ERROR, { ignoreCase: true }],
1778
1756
  "react/jsx-no-literals": [OFF, { noStrings: true }],
1779
- "react/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
1780
1757
  "react/jsx-pascal-case": [ERROR, {
1781
1758
  allowAllCaps: true,
1782
1759
  ignore: []
1783
1760
  }],
1784
- "react/jsx-props-no-multi-spaces": ERROR,
1785
1761
  "react/jsx-sort-default-props": [OFF, {
1786
1762
  ignoreCase: true
1787
1763
  }],
1788
- // Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
1789
- "react/jsx-sort-props": [OFF],
1790
- "react/jsx-tag-spacing": [ERROR, {
1791
- afterOpening: NEVER,
1792
- beforeClosing: NEVER,
1793
- beforeSelfClosing: "always",
1794
- closingSlash: NEVER
1795
- }],
1796
- "react/jsx-wrap-multilines": [ERROR, {
1797
- arrow: STR_PARENS_NEW_LINE,
1798
- assignment: STR_PARENS_NEW_LINE,
1799
- condition: STR_PARENS_NEW_LINE,
1800
- declaration: STR_PARENS_NEW_LINE,
1801
- logical: STR_PARENS_NEW_LINE,
1802
- prop: STR_PARENS_NEW_LINE,
1803
- return: STR_PARENS_NEW_LINE
1804
- }],
1805
1764
  "react/no-danger": WARN,
1806
1765
  "react/no-unescaped-entities": OFF,
1807
1766
  "react/prop-types": OFF,
@@ -2031,6 +1990,7 @@ function sortTsconfig() {
2031
1990
  }
2032
1991
 
2033
1992
  // src/configs/stylistic.ts
1993
+ var STR_PARENS_NEW_LINE = "parens-new-line";
2034
1994
  var STYLISTIC_CONFIG_DEFAULTS = {
2035
1995
  indent: 2,
2036
1996
  jsx: true,
@@ -2073,6 +2033,46 @@ async function stylistic(options = {}) {
2073
2033
  "style/arrow-parens": [ERROR, ALWAYS],
2074
2034
  "style/brace-style": [ERROR],
2075
2035
  "style/func-call-spacing": [ERROR, NEVER],
2036
+ "style/jsx-child-element-spacing": OFF,
2037
+ "style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
2038
+ "style/jsx-closing-tag-location": ERROR,
2039
+ "style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
2040
+ "style/jsx-curly-newline": [ERROR, {
2041
+ multiline: "consistent",
2042
+ singleline: "consistent"
2043
+ }],
2044
+ "style/jsx-curly-spacing": [ERROR, {
2045
+ children: true,
2046
+ spacing: {
2047
+ objectLiterals: NEVER
2048
+ },
2049
+ when: "always"
2050
+ }],
2051
+ "style/jsx-equals-spacing": [ERROR, NEVER],
2052
+ "style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
2053
+ "style/jsx-indent": [ERROR, 2],
2054
+ "style/jsx-indent-props": [ERROR, 2],
2055
+ "style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
2056
+ "style/jsx-newline": ERROR,
2057
+ "style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
2058
+ "style/jsx-props-no-multi-spaces": ERROR,
2059
+ // Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
2060
+ "style/jsx-sort-props": [OFF],
2061
+ "style/jsx-tag-spacing": [ERROR, {
2062
+ afterOpening: NEVER,
2063
+ beforeClosing: NEVER,
2064
+ beforeSelfClosing: "always",
2065
+ closingSlash: NEVER
2066
+ }],
2067
+ "style/jsx-wrap-multilines": [ERROR, {
2068
+ arrow: STR_PARENS_NEW_LINE,
2069
+ assignment: STR_PARENS_NEW_LINE,
2070
+ condition: STR_PARENS_NEW_LINE,
2071
+ declaration: STR_PARENS_NEW_LINE,
2072
+ logical: STR_PARENS_NEW_LINE,
2073
+ prop: STR_PARENS_NEW_LINE,
2074
+ return: STR_PARENS_NEW_LINE
2075
+ }],
2076
2076
  "style/member-delimiter-style": [ERROR],
2077
2077
  "style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
2078
2078
  "style/object-curly-spacing": [ERROR, ALWAYS],
@@ -2157,6 +2157,8 @@ async function typescript(options = {}) {
2157
2157
  ...componentExts.map((ext) => `**/*.${ext}`)
2158
2158
  ];
2159
2159
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
2160
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2161
+ const isTypeAware = !!tsconfigPath;
2160
2162
  const typeAwareRules = {
2161
2163
  "dot-notation": OFF,
2162
2164
  "no-implied-eval": OFF,
@@ -2172,7 +2174,6 @@ async function typescript(options = {}) {
2172
2174
  "ts/restrict-plus-operands": ERROR,
2173
2175
  "ts/restrict-template-expressions": ERROR
2174
2176
  };
2175
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2176
2177
  const [
2177
2178
  pluginTs,
2178
2179
  parserTs
@@ -2180,29 +2181,41 @@ async function typescript(options = {}) {
2180
2181
  interopDefault(import("@typescript-eslint/eslint-plugin")),
2181
2182
  interopDefault(import("@typescript-eslint/parser"))
2182
2183
  ]);
2183
- return [
2184
- {
2185
- // Install the plugins without globs, so they can be configured separately.
2186
- name: "vinicunca:typescript:setup",
2187
- plugins: {
2188
- ts: pluginTs,
2189
- vinicunca: default2
2190
- }
2191
- },
2192
- {
2193
- files,
2184
+ function makeParser({ files: files2, ignores: ignores2, typeAware }) {
2185
+ return {
2186
+ files: files2,
2187
+ ...ignores2 ? { ignores: ignores2 } : {},
2194
2188
  languageOptions: {
2195
2189
  parser: parserTs,
2196
2190
  parserOptions: {
2197
2191
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
2198
2192
  sourceType: "module",
2199
- ...tsconfigPath ? {
2193
+ ...typeAware ? {
2200
2194
  project: tsconfigPath,
2201
2195
  tsconfigRootDir: process.cwd()
2202
2196
  } : {},
2203
2197
  ...parserOptions
2204
2198
  }
2205
2199
  },
2200
+ name: `vinicunca:typescript:${typeAware ? "type-aware-parser" : "parser"}`
2201
+ };
2202
+ }
2203
+ return [
2204
+ {
2205
+ // Install the plugins without globs, so they can be configured separately.
2206
+ name: "vinicunca:typescript:setup",
2207
+ plugins: {
2208
+ ts: pluginTs,
2209
+ vinicunca: default2
2210
+ }
2211
+ },
2212
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
2213
+ ...isTypeAware ? [
2214
+ makeParser({ files: filesTypeAware, typeAware: true }),
2215
+ makeParser({ files, ignores: filesTypeAware, typeAware: false })
2216
+ ] : [makeParser({ files, typeAware: false })],
2217
+ {
2218
+ files,
2206
2219
  name: "vinicunca:typescript:rules",
2207
2220
  rules: {
2208
2221
  ...renameRules(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vinicunca/eslint-config",
3
3
  "type": "module",
4
- "version": "2.1.2",
4
+ "version": "2.1.5",
5
5
  "description": "Vinicunca ESLint config",
6
6
  "author": {
7
7
  "name": "praburangki",
@@ -60,11 +60,11 @@
60
60
  "dependencies": {
61
61
  "@antfu/eslint-define-config": "1.23.0-2",
62
62
  "@eslint-types/jsdoc": "^46.9.1",
63
- "@eslint-types/typescript-eslint": "^6.17.0",
63
+ "@eslint-types/typescript-eslint": "^6.18.1",
64
64
  "@eslint-types/unicorn": "^50.0.1",
65
- "@stylistic/eslint-plugin": "^1.5.3",
66
- "@typescript-eslint/eslint-plugin": "^6.18.1",
67
- "@typescript-eslint/parser": "^6.18.1",
65
+ "@stylistic/eslint-plugin": "^1.5.4",
66
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
67
+ "@typescript-eslint/parser": "^6.19.0",
68
68
  "@unocss/eslint-plugin": "^0.58.3",
69
69
  "@vinicunca/eslint-plugin-vinicunca": "^1.0.10",
70
70
  "eslint-merge-processors": "^0.1.0",
@@ -72,7 +72,7 @@
72
72
  "eslint-plugin-format": "^0.1.0",
73
73
  "eslint-plugin-i": "^2.29.1",
74
74
  "eslint-plugin-jsdoc": "^48.0.2",
75
- "eslint-plugin-jsonc": "^2.11.2",
75
+ "eslint-plugin-jsonc": "^2.12.2",
76
76
  "eslint-plugin-markdown": "^3.0.1",
77
77
  "eslint-plugin-n": "^16.6.2",
78
78
  "eslint-plugin-no-only-tests": "^3.1.0",
@@ -82,8 +82,8 @@
82
82
  "eslint-plugin-unicorn": "^50.0.1",
83
83
  "eslint-plugin-unused-imports": "^3.0.0",
84
84
  "eslint-plugin-vitest": "^0.3.20",
85
- "eslint-plugin-vue": "^9.19.2",
86
- "eslint-plugin-yml": "^1.11.0",
85
+ "eslint-plugin-vue": "^9.20.1",
86
+ "eslint-plugin-yml": "^1.12.2",
87
87
  "eslint-processor-vue-blocks": "^0.1.1",
88
88
  "globals": "^13.24.0",
89
89
  "jsonc-eslint-parser": "^2.4.0",
@@ -93,15 +93,15 @@
93
93
  "yaml-eslint-parser": "^1.2.2"
94
94
  },
95
95
  "devDependencies": {
96
- "@eslint-stylistic/metadata": "^1.5.3",
97
- "@types/eslint": "^8.56.0",
96
+ "@eslint-stylistic/metadata": "^1.5.4",
97
+ "@types/eslint": "^8.56.2",
98
98
  "@types/fs-extra": "^11.0.4",
99
99
  "execa": "^8.0.1",
100
100
  "fast-glob": "^3.3.2",
101
101
  "fs-extra": "^11.2.0",
102
102
  "react": "^18.2.0",
103
103
  "tsup": "^8.0.1",
104
- "vue": "^3.4.7"
104
+ "vue": "^3.4.14"
105
105
  },
106
106
  "scripts": {
107
107
  "lint": "eslint -v",