@santi020k/eslint-config-santi020k 3.1.3 → 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 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
- parser: tsParser
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",
@@ -511,27 +500,83 @@ var markdown = [
511
500
  // Disable js/ts Eslint rules, markdown issues
512
501
  indent: "off",
513
502
  "no-irregular-whitespace": "off",
514
- "@stylistic/indent": "off"
503
+ "@stylistic/indent": "off",
504
+ "no-unused-vars": "off",
505
+ "@stylistic/jsx-closing-bracket-location": "off",
506
+ "no-multi-spaces": "off",
507
+ "@stylistic/no-multi-spaces": "off",
508
+ "comma-dangle": "off",
509
+ "@stylistic/jsx-tag-spacing": "off"
515
510
  }
516
511
  }
517
512
  ];
518
513
 
519
514
  // src/optionals/mdx.ts
515
+ import eslintMdx from "eslint-mdx";
520
516
  import pluginMdx from "eslint-plugin-mdx";
521
517
  var mdx = [
522
518
  {
523
- name: "mdx-flat",
524
- ...pluginMdx.flat
525
- },
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 = [
526
542
  {
527
- name: "mdx-blocks",
528
- ...pluginMdx.flatCodeBlocks,
543
+ name: "stencil-community",
544
+ files: ["**/*.{tsx,ts}"],
545
+ plugins: {
546
+ "@stencil-community": fixupPluginRules({
547
+ rules: stencilPlugin.rules
548
+ })
549
+ },
529
550
  rules: {
530
- ...pluginMdx.flatCodeBlocks.rules,
531
- // Disable js/ts Eslint rules, markdown issues
532
- indent: "off",
533
- "no-irregular-whitespace": "off",
534
- "@stylistic/indent": "off"
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"
535
580
  }
536
581
  }
537
582
  ];
@@ -541,16 +586,19 @@ import pluginTailwind from "eslint-plugin-tailwindcss";
541
586
  var tailwind = [...pluginTailwind.configs["flat/recommended"]];
542
587
 
543
588
  // src/optionals/vitest.ts
589
+ import testingLibrary from "eslint-plugin-testing-library";
544
590
  import pluginVitest from "eslint-plugin-vitest";
545
- import { fixupConfigRules as fixupConfigRules5 } from "@eslint/compat";
591
+ import { fixupPluginRules as fixupPluginRules2 } from "@eslint/compat";
546
592
  var vitest = [
547
- ...fixupConfigRules5(flatCompat.extends("plugin:testing-library/react")),
548
593
  {
549
594
  name: "vitest",
550
- files: ["tests/**"],
595
+ files: ["tests/**", "**/__tests__/**", "**/__mocks__/**", "**/test/**", "**/spec/**", "**/__spec__/**", "**/*.test.{js,ts,jsx,tsx}"],
551
596
  // or any other pattern
552
597
  plugins: {
553
- vitest: pluginVitest
598
+ vitest: pluginVitest,
599
+ "testing-library": fixupPluginRules2({
600
+ rules: testingLibrary.rules
601
+ })
554
602
  },
555
603
  rules: {
556
604
  ...pluginVitest.configs.recommended.rules,
@@ -567,6 +615,12 @@ var vitest = [
567
615
  }
568
616
  ];
569
617
 
618
+ // src/settings/gitignore.ts
619
+ import { includeIgnoreFile } from "@eslint/compat";
620
+ var gitignore = [
621
+ includeIgnoreFile(`${process.cwd()}/.gitignore`)
622
+ ];
623
+
570
624
  // src/index.ts
571
625
  var ConfigOption2 = /* @__PURE__ */ ((ConfigOption3) => {
572
626
  ConfigOption3["Ts"] = "ts";
@@ -583,8 +637,13 @@ var OptionalOption = /* @__PURE__ */ ((OptionalOption2) => {
583
637
  OptionalOption2["I18next"] = "i18next";
584
638
  OptionalOption2["Mdx"] = "mdx";
585
639
  OptionalOption2["Markdown"] = "markdown";
640
+ OptionalOption2["Stencil"] = "stencil";
586
641
  return OptionalOption2;
587
642
  })(OptionalOption || {});
643
+ var SettingOption = /* @__PURE__ */ ((SettingOption2) => {
644
+ SettingOption2["Gitignore"] = "gitignore";
645
+ return SettingOption2;
646
+ })(SettingOption || {});
588
647
  var ReactConfigs = [
589
648
  "react" /* React */,
590
649
  "astro" /* Astro */,
@@ -593,10 +652,12 @@ var ReactConfigs = [
593
652
  ];
594
653
  var eslintConfig = ({
595
654
  config = [],
596
- optionals = []
655
+ optionals = [],
656
+ settings = []
597
657
  } = {}) => {
598
658
  const hasReact = hasReactConfig(config);
599
659
  return [
660
+ ...settings.includes("gitignore" /* Gitignore */) ? gitignore : [],
600
661
  ...jsConfig,
601
662
  ...hasReact ? reactConfig : [],
602
663
  ...applyConfigIfOptionPresent(config, "ts" /* Ts */, tsConfig),
@@ -607,6 +668,7 @@ var eslintConfig = ({
607
668
  ...optionals.includes("tailwind" /* Tailwind */) ? tailwind : [],
608
669
  ...optionals.includes("vitest" /* Vitest */) ? vitest : [],
609
670
  ...optionals.includes("i18next" /* I18next */) ? i18next : [],
671
+ ...optionals.includes("stencil" /* Stencil */) ? stencil : [],
610
672
  ...optionals.includes("mdx" /* Mdx */) ? mdx : [],
611
673
  ...optionals.includes("markdown" /* Markdown */) ? markdown : []
612
674
  ];
@@ -615,5 +677,6 @@ export {
615
677
  ConfigOption2 as ConfigOption,
616
678
  OptionalOption,
617
679
  ReactConfigs,
680
+ SettingOption,
618
681
  eslintConfig
619
682
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@santi020k/eslint-config-santi020k",
3
- "version": "3.1.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",