@santi020k/eslint-config-santi020k 3.1.4 → 3.2.1
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 +89 -32
- 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,25 +512,29 @@ 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
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
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
|
+
},
|
|
537
531
|
rules: {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
indent: "off",
|
|
541
|
-
"no-irregular-whitespace": "off",
|
|
542
|
-
"@stylistic/indent": "off",
|
|
532
|
+
"mdx/remark": "warn",
|
|
533
|
+
"react/react-in-jsx-scope": 0,
|
|
543
534
|
"no-unused-vars": "off",
|
|
535
|
+
"@stylistic/indent": "off",
|
|
544
536
|
"@stylistic/jsx-closing-bracket-location": "off",
|
|
537
|
+
indent: "off",
|
|
545
538
|
"no-multi-spaces": "off",
|
|
546
539
|
"@stylistic/no-multi-spaces": "off",
|
|
547
540
|
"comma-dangle": "off",
|
|
@@ -550,21 +543,70 @@ var mdx = [
|
|
|
550
543
|
}
|
|
551
544
|
];
|
|
552
545
|
|
|
546
|
+
// src/optionals/stencil.ts
|
|
547
|
+
import { fixupPluginRules } from "@eslint/compat";
|
|
548
|
+
import stencilPlugin from "@stencil-community/eslint-plugin";
|
|
549
|
+
var stencil = [
|
|
550
|
+
{
|
|
551
|
+
name: "stencil-community",
|
|
552
|
+
files: ["**/*.{tsx,ts}"],
|
|
553
|
+
plugins: {
|
|
554
|
+
"@stencil-community": fixupPluginRules({
|
|
555
|
+
rules: stencilPlugin.rules
|
|
556
|
+
})
|
|
557
|
+
},
|
|
558
|
+
rules: {
|
|
559
|
+
"@stencil-community/async-methods": "error",
|
|
560
|
+
"@stencil-community/ban-prefix": ["error", ["stencil", "stnl", "st"]],
|
|
561
|
+
"@stencil-community/decorators-context": "error",
|
|
562
|
+
"@stencil-community/decorators-style": [
|
|
563
|
+
"error",
|
|
564
|
+
{
|
|
565
|
+
prop: "inline",
|
|
566
|
+
state: "inline",
|
|
567
|
+
element: "inline",
|
|
568
|
+
event: "inline",
|
|
569
|
+
method: "multiline",
|
|
570
|
+
watch: "multiline",
|
|
571
|
+
listen: "multiline"
|
|
572
|
+
}
|
|
573
|
+
],
|
|
574
|
+
"@stencil-community/element-type": "error",
|
|
575
|
+
"@stencil-community/host-data-deprecated": "error",
|
|
576
|
+
"@stencil-community/methods-must-be-public": "error",
|
|
577
|
+
"@stencil-community/no-unused-watch": "error",
|
|
578
|
+
"@stencil-community/own-methods-must-be-private": "error",
|
|
579
|
+
"@stencil-community/own-props-must-be-private": "error",
|
|
580
|
+
"@stencil-community/prefer-vdom-listener": "error",
|
|
581
|
+
"@stencil-community/props-must-be-public": "error",
|
|
582
|
+
"@stencil-community/props-must-be-readonly": "error",
|
|
583
|
+
"@stencil-community/render-returns-host": "error",
|
|
584
|
+
"@stencil-community/required-jsdoc": "error",
|
|
585
|
+
"@stencil-community/reserved-member-names": "error",
|
|
586
|
+
"@stencil-community/single-export": "error",
|
|
587
|
+
"@stencil-community/strict-mutable": "error"
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
];
|
|
591
|
+
|
|
553
592
|
// src/optionals/tailwind.ts
|
|
554
593
|
import pluginTailwind from "eslint-plugin-tailwindcss";
|
|
555
594
|
var tailwind = [...pluginTailwind.configs["flat/recommended"]];
|
|
556
595
|
|
|
557
596
|
// src/optionals/vitest.ts
|
|
597
|
+
import testingLibrary from "eslint-plugin-testing-library";
|
|
558
598
|
import pluginVitest from "eslint-plugin-vitest";
|
|
559
|
-
import {
|
|
599
|
+
import { fixupPluginRules as fixupPluginRules2 } from "@eslint/compat";
|
|
560
600
|
var vitest = [
|
|
561
|
-
...fixupConfigRules5(flatCompat.extends("plugin:testing-library/react")),
|
|
562
601
|
{
|
|
563
602
|
name: "vitest",
|
|
564
|
-
files: ["tests/**"],
|
|
603
|
+
files: ["tests/**", "**/__tests__/**", "**/__mocks__/**", "**/test/**", "**/spec/**", "**/__spec__/**", "**/*.test.{js,ts,jsx,tsx}"],
|
|
565
604
|
// or any other pattern
|
|
566
605
|
plugins: {
|
|
567
|
-
vitest: pluginVitest
|
|
606
|
+
vitest: pluginVitest,
|
|
607
|
+
"testing-library": fixupPluginRules2({
|
|
608
|
+
rules: testingLibrary.rules
|
|
609
|
+
})
|
|
568
610
|
},
|
|
569
611
|
rules: {
|
|
570
612
|
...pluginVitest.configs.recommended.rules,
|
|
@@ -581,6 +623,12 @@ var vitest = [
|
|
|
581
623
|
}
|
|
582
624
|
];
|
|
583
625
|
|
|
626
|
+
// src/settings/gitignore.ts
|
|
627
|
+
import { includeIgnoreFile } from "@eslint/compat";
|
|
628
|
+
var gitignore = [
|
|
629
|
+
includeIgnoreFile(`${process.cwd()}/.gitignore`)
|
|
630
|
+
];
|
|
631
|
+
|
|
584
632
|
// src/index.ts
|
|
585
633
|
var ConfigOption2 = /* @__PURE__ */ ((ConfigOption3) => {
|
|
586
634
|
ConfigOption3["Ts"] = "ts";
|
|
@@ -597,8 +645,13 @@ var OptionalOption = /* @__PURE__ */ ((OptionalOption2) => {
|
|
|
597
645
|
OptionalOption2["I18next"] = "i18next";
|
|
598
646
|
OptionalOption2["Mdx"] = "mdx";
|
|
599
647
|
OptionalOption2["Markdown"] = "markdown";
|
|
648
|
+
OptionalOption2["Stencil"] = "stencil";
|
|
600
649
|
return OptionalOption2;
|
|
601
650
|
})(OptionalOption || {});
|
|
651
|
+
var SettingOption = /* @__PURE__ */ ((SettingOption2) => {
|
|
652
|
+
SettingOption2["Gitignore"] = "gitignore";
|
|
653
|
+
return SettingOption2;
|
|
654
|
+
})(SettingOption || {});
|
|
602
655
|
var ReactConfigs = [
|
|
603
656
|
"react" /* React */,
|
|
604
657
|
"astro" /* Astro */,
|
|
@@ -607,10 +660,12 @@ var ReactConfigs = [
|
|
|
607
660
|
];
|
|
608
661
|
var eslintConfig = ({
|
|
609
662
|
config = [],
|
|
610
|
-
optionals = []
|
|
663
|
+
optionals = [],
|
|
664
|
+
settings = []
|
|
611
665
|
} = {}) => {
|
|
612
666
|
const hasReact = hasReactConfig(config);
|
|
613
667
|
return [
|
|
668
|
+
...settings.includes("gitignore" /* Gitignore */) ? gitignore : [],
|
|
614
669
|
...jsConfig,
|
|
615
670
|
...hasReact ? reactConfig : [],
|
|
616
671
|
...applyConfigIfOptionPresent(config, "ts" /* Ts */, tsConfig),
|
|
@@ -621,6 +676,7 @@ var eslintConfig = ({
|
|
|
621
676
|
...optionals.includes("tailwind" /* Tailwind */) ? tailwind : [],
|
|
622
677
|
...optionals.includes("vitest" /* Vitest */) ? vitest : [],
|
|
623
678
|
...optionals.includes("i18next" /* I18next */) ? i18next : [],
|
|
679
|
+
...optionals.includes("stencil" /* Stencil */) ? stencil : [],
|
|
624
680
|
...optionals.includes("mdx" /* Mdx */) ? mdx : [],
|
|
625
681
|
...optionals.includes("markdown" /* Markdown */) ? markdown : []
|
|
626
682
|
];
|
|
@@ -629,5 +685,6 @@ export {
|
|
|
629
685
|
ConfigOption2 as ConfigOption,
|
|
630
686
|
OptionalOption,
|
|
631
687
|
ReactConfigs,
|
|
688
|
+
SettingOption,
|
|
632
689
|
eslintConfig
|
|
633
690
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@santi020k/eslint-config-santi020k",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
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",
|