@santi020k/eslint-config-santi020k 3.1.4 → 3.2.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/README.md +16 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +86 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,12 +127,28 @@ Additionally, there are some optional parameters that add support to other techn
|
|
|
127
127
|
OptionalOption.Mdx,
|
|
128
128
|
// Markdown
|
|
129
129
|
OptionalOption.Markdown,
|
|
130
|
+
// Stencil
|
|
131
|
+
OptionalOption.Stencil
|
|
130
132
|
]
|
|
131
133
|
}),
|
|
132
134
|
// Your custom config
|
|
133
135
|
];
|
|
134
136
|
```
|
|
135
137
|
|
|
138
|
+
### Setting Usage (experimental)
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
import { eslintConfig, SettingOption } from '@santi020k/eslint-config-santi020k';
|
|
142
|
+
|
|
143
|
+
export default [
|
|
144
|
+
...eslintConfig({
|
|
145
|
+
// Adds support for .gitignore file, eslint will ignore files in the .gitignore file
|
|
146
|
+
settings: [SettingOption.Gitignore]
|
|
147
|
+
}),
|
|
148
|
+
// Your custom config
|
|
149
|
+
];
|
|
150
|
+
```
|
|
151
|
+
|
|
136
152
|
## Opinionated but Flexible
|
|
137
153
|
|
|
138
154
|
This ESLint configuration is based on my personal preferences and practices. As such, it may evolve over time. I recommend using a fixed version to avoid unexpected changes. If a rule is too strict, consider changing it from an error to a warning to allow for more flexibility during development.
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,14 @@ declare enum OptionalOption {
|
|
|
19
19
|
Vitest = "vitest",
|
|
20
20
|
I18next = "i18next",
|
|
21
21
|
Mdx = "mdx",
|
|
22
|
-
Markdown = "markdown"
|
|
22
|
+
Markdown = "markdown",
|
|
23
|
+
Stencil = "stencil"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Enum for settings options in ESLint
|
|
27
|
+
*/
|
|
28
|
+
declare enum SettingOption {
|
|
29
|
+
Gitignore = "gitignore"
|
|
23
30
|
}
|
|
24
31
|
/**
|
|
25
32
|
* Array of configurations that require React
|
|
@@ -31,6 +38,7 @@ declare const ReactConfigs: ConfigOption[];
|
|
|
31
38
|
interface EslintConfig {
|
|
32
39
|
config?: ConfigOption[];
|
|
33
40
|
optionals?: OptionalOption[];
|
|
41
|
+
settings?: SettingOption[];
|
|
34
42
|
}
|
|
35
43
|
/**
|
|
36
44
|
* Generates the ESLint configuration array, applying configurations
|
|
@@ -39,6 +47,6 @@ interface EslintConfig {
|
|
|
39
47
|
* @param {EslintConfig} options - Configuration and optional settings
|
|
40
48
|
* @returns {TSESLint.FlatConfig.ConfigArray} The final ESLint configuration array
|
|
41
49
|
*/
|
|
42
|
-
declare const eslintConfig: ({ config, optionals }?: EslintConfig) => TSESLint.FlatConfig.ConfigArray;
|
|
50
|
+
declare const eslintConfig: ({ config, optionals, settings }?: EslintConfig) => TSESLint.FlatConfig.ConfigArray;
|
|
43
51
|
|
|
44
|
-
export { ConfigOption, OptionalOption, ReactConfigs, eslintConfig };
|
|
52
|
+
export { ConfigOption, OptionalOption, ReactConfigs, SettingOption, eslintConfig };
|
package/dist/index.js
CHANGED
|
@@ -259,12 +259,7 @@ var jsConfig = [
|
|
|
259
259
|
name: "custom-js",
|
|
260
260
|
languageOptions,
|
|
261
261
|
files: ["**/*.{js,jsx,mjs,cjs}"],
|
|
262
|
-
ignores: ["node_modules/*"],
|
|
263
262
|
rules
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
name: "ignore-node-modules-js",
|
|
267
|
-
ignores: ["node_modules/*"]
|
|
268
263
|
}
|
|
269
264
|
];
|
|
270
265
|
|
|
@@ -437,17 +432,13 @@ var tsConfig = [
|
|
|
437
432
|
files: ["**/*.{ts,tsx,mts,cts}"],
|
|
438
433
|
rules: rules5,
|
|
439
434
|
languageOptions: {
|
|
435
|
+
parser: tsParser,
|
|
440
436
|
parserOptions: {
|
|
441
|
-
|
|
437
|
+
project: true
|
|
442
438
|
},
|
|
443
439
|
ecmaVersion: "latest"
|
|
444
440
|
}
|
|
445
441
|
}
|
|
446
|
-
// TODO: Temporal
|
|
447
|
-
// {
|
|
448
|
-
// name: 'ignore-node-modules-ts',
|
|
449
|
-
// ignores: ['node_modules/*']
|
|
450
|
-
// }
|
|
451
442
|
];
|
|
452
443
|
|
|
453
444
|
// src/configs/expo/rules.ts
|
|
@@ -493,12 +484,10 @@ var i18next = [
|
|
|
493
484
|
// src/optionals/markdown.ts
|
|
494
485
|
import pluginMarkdown from "@eslint/markdown";
|
|
495
486
|
var markdown = [
|
|
487
|
+
...pluginMarkdown.configs.recommended,
|
|
496
488
|
{
|
|
497
489
|
name: "markdown",
|
|
498
490
|
files: ["**/*.md"],
|
|
499
|
-
plugins: {
|
|
500
|
-
markdown: pluginMarkdown
|
|
501
|
-
},
|
|
502
491
|
language: "markdown/commonmark",
|
|
503
492
|
rules: {
|
|
504
493
|
"markdown/fenced-code-language": "error",
|
|
@@ -523,29 +512,71 @@ var markdown = [
|
|
|
523
512
|
];
|
|
524
513
|
|
|
525
514
|
// src/optionals/mdx.ts
|
|
515
|
+
import eslintMdx from "eslint-mdx";
|
|
526
516
|
import pluginMdx from "eslint-plugin-mdx";
|
|
527
517
|
var mdx = [
|
|
528
518
|
{
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
519
|
+
files: ["**/*.mdx"],
|
|
520
|
+
languageOptions: {
|
|
521
|
+
sourceType: "module",
|
|
522
|
+
ecmaVersion: "latest",
|
|
523
|
+
parser: eslintMdx,
|
|
524
|
+
globals: {
|
|
525
|
+
React: false
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
plugins: {
|
|
529
|
+
mdx: pluginMdx
|
|
530
|
+
},
|
|
531
|
+
rules: {
|
|
532
|
+
"mdx/remark": "warn",
|
|
533
|
+
"react/react-in-jsx-scope": 0
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
];
|
|
537
|
+
|
|
538
|
+
// src/optionals/stencil.ts
|
|
539
|
+
import { fixupPluginRules } from "@eslint/compat";
|
|
540
|
+
import stencilPlugin from "@stencil-community/eslint-plugin";
|
|
541
|
+
var stencil = [
|
|
533
542
|
{
|
|
534
|
-
name: "
|
|
535
|
-
files: ["**/*.{
|
|
536
|
-
|
|
543
|
+
name: "stencil-community",
|
|
544
|
+
files: ["**/*.{tsx,ts}"],
|
|
545
|
+
plugins: {
|
|
546
|
+
"@stencil-community": fixupPluginRules({
|
|
547
|
+
rules: stencilPlugin.rules
|
|
548
|
+
})
|
|
549
|
+
},
|
|
537
550
|
rules: {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
"
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
551
|
+
"@stencil-community/async-methods": "error",
|
|
552
|
+
"@stencil-community/ban-prefix": ["error", ["stencil", "stnl", "st"]],
|
|
553
|
+
"@stencil-community/decorators-context": "error",
|
|
554
|
+
"@stencil-community/decorators-style": [
|
|
555
|
+
"error",
|
|
556
|
+
{
|
|
557
|
+
prop: "inline",
|
|
558
|
+
state: "inline",
|
|
559
|
+
element: "inline",
|
|
560
|
+
event: "inline",
|
|
561
|
+
method: "multiline",
|
|
562
|
+
watch: "multiline",
|
|
563
|
+
listen: "multiline"
|
|
564
|
+
}
|
|
565
|
+
],
|
|
566
|
+
"@stencil-community/element-type": "error",
|
|
567
|
+
"@stencil-community/host-data-deprecated": "error",
|
|
568
|
+
"@stencil-community/methods-must-be-public": "error",
|
|
569
|
+
"@stencil-community/no-unused-watch": "error",
|
|
570
|
+
"@stencil-community/own-methods-must-be-private": "error",
|
|
571
|
+
"@stencil-community/own-props-must-be-private": "error",
|
|
572
|
+
"@stencil-community/prefer-vdom-listener": "error",
|
|
573
|
+
"@stencil-community/props-must-be-public": "error",
|
|
574
|
+
"@stencil-community/props-must-be-readonly": "error",
|
|
575
|
+
"@stencil-community/render-returns-host": "error",
|
|
576
|
+
"@stencil-community/required-jsdoc": "error",
|
|
577
|
+
"@stencil-community/reserved-member-names": "error",
|
|
578
|
+
"@stencil-community/single-export": "error",
|
|
579
|
+
"@stencil-community/strict-mutable": "error"
|
|
549
580
|
}
|
|
550
581
|
}
|
|
551
582
|
];
|
|
@@ -555,16 +586,19 @@ import pluginTailwind from "eslint-plugin-tailwindcss";
|
|
|
555
586
|
var tailwind = [...pluginTailwind.configs["flat/recommended"]];
|
|
556
587
|
|
|
557
588
|
// src/optionals/vitest.ts
|
|
589
|
+
import testingLibrary from "eslint-plugin-testing-library";
|
|
558
590
|
import pluginVitest from "eslint-plugin-vitest";
|
|
559
|
-
import {
|
|
591
|
+
import { fixupPluginRules as fixupPluginRules2 } from "@eslint/compat";
|
|
560
592
|
var vitest = [
|
|
561
|
-
...fixupConfigRules5(flatCompat.extends("plugin:testing-library/react")),
|
|
562
593
|
{
|
|
563
594
|
name: "vitest",
|
|
564
|
-
files: ["tests/**"],
|
|
595
|
+
files: ["tests/**", "**/__tests__/**", "**/__mocks__/**", "**/test/**", "**/spec/**", "**/__spec__/**", "**/*.test.{js,ts,jsx,tsx}"],
|
|
565
596
|
// or any other pattern
|
|
566
597
|
plugins: {
|
|
567
|
-
vitest: pluginVitest
|
|
598
|
+
vitest: pluginVitest,
|
|
599
|
+
"testing-library": fixupPluginRules2({
|
|
600
|
+
rules: testingLibrary.rules
|
|
601
|
+
})
|
|
568
602
|
},
|
|
569
603
|
rules: {
|
|
570
604
|
...pluginVitest.configs.recommended.rules,
|
|
@@ -581,6 +615,12 @@ var vitest = [
|
|
|
581
615
|
}
|
|
582
616
|
];
|
|
583
617
|
|
|
618
|
+
// src/settings/gitignore.ts
|
|
619
|
+
import { includeIgnoreFile } from "@eslint/compat";
|
|
620
|
+
var gitignore = [
|
|
621
|
+
includeIgnoreFile(`${process.cwd()}/.gitignore`)
|
|
622
|
+
];
|
|
623
|
+
|
|
584
624
|
// src/index.ts
|
|
585
625
|
var ConfigOption2 = /* @__PURE__ */ ((ConfigOption3) => {
|
|
586
626
|
ConfigOption3["Ts"] = "ts";
|
|
@@ -597,8 +637,13 @@ var OptionalOption = /* @__PURE__ */ ((OptionalOption2) => {
|
|
|
597
637
|
OptionalOption2["I18next"] = "i18next";
|
|
598
638
|
OptionalOption2["Mdx"] = "mdx";
|
|
599
639
|
OptionalOption2["Markdown"] = "markdown";
|
|
640
|
+
OptionalOption2["Stencil"] = "stencil";
|
|
600
641
|
return OptionalOption2;
|
|
601
642
|
})(OptionalOption || {});
|
|
643
|
+
var SettingOption = /* @__PURE__ */ ((SettingOption2) => {
|
|
644
|
+
SettingOption2["Gitignore"] = "gitignore";
|
|
645
|
+
return SettingOption2;
|
|
646
|
+
})(SettingOption || {});
|
|
602
647
|
var ReactConfigs = [
|
|
603
648
|
"react" /* React */,
|
|
604
649
|
"astro" /* Astro */,
|
|
@@ -607,10 +652,12 @@ var ReactConfigs = [
|
|
|
607
652
|
];
|
|
608
653
|
var eslintConfig = ({
|
|
609
654
|
config = [],
|
|
610
|
-
optionals = []
|
|
655
|
+
optionals = [],
|
|
656
|
+
settings = []
|
|
611
657
|
} = {}) => {
|
|
612
658
|
const hasReact = hasReactConfig(config);
|
|
613
659
|
return [
|
|
660
|
+
...settings.includes("gitignore" /* Gitignore */) ? gitignore : [],
|
|
614
661
|
...jsConfig,
|
|
615
662
|
...hasReact ? reactConfig : [],
|
|
616
663
|
...applyConfigIfOptionPresent(config, "ts" /* Ts */, tsConfig),
|
|
@@ -621,6 +668,7 @@ var eslintConfig = ({
|
|
|
621
668
|
...optionals.includes("tailwind" /* Tailwind */) ? tailwind : [],
|
|
622
669
|
...optionals.includes("vitest" /* Vitest */) ? vitest : [],
|
|
623
670
|
...optionals.includes("i18next" /* I18next */) ? i18next : [],
|
|
671
|
+
...optionals.includes("stencil" /* Stencil */) ? stencil : [],
|
|
624
672
|
...optionals.includes("mdx" /* Mdx */) ? mdx : [],
|
|
625
673
|
...optionals.includes("markdown" /* Markdown */) ? markdown : []
|
|
626
674
|
];
|
|
@@ -629,5 +677,6 @@ export {
|
|
|
629
677
|
ConfigOption2 as ConfigOption,
|
|
630
678
|
OptionalOption,
|
|
631
679
|
ReactConfigs,
|
|
680
|
+
SettingOption,
|
|
632
681
|
eslintConfig
|
|
633
682
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@santi020k/eslint-config-santi020k",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "A comprehensive ESLint configuration package for JavaScript, TypeScript, and React projects, including popular plugins and custom rules for consistent coding style.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|