@santi020k/eslint-config-santi020k 1.2.1 → 2.0.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
@@ -1,24 +1,13 @@
1
1
  # @santi020k/eslint-config-santi020k
2
2
 
3
- Welcome to @santi020k/eslint-config-santi020k, a comprehensive and opinionated ESLint configuration package for JavaScript, TypeScript, and React projects. This repository was born out of my frustration with starting or working on projects that suffer from bad practices and poor quality code. By automating code quality and reducing the cognitive load during code reviews, this package aims to enforce a consistent coding style across your projects.
3
+ Welcome to @santi020k/eslint-config-santi020k, a comprehensive and opinionated ESLint configuration package for JavaScript, TypeScript, React, and various other frameworks. This repository was born out of my frustration with projects that suffer from bad practices and poor code quality. By automating code quality and reducing cognitive load during code reviews, this package aims to enforce a consistent coding style across your projects.
4
4
 
5
5
  ## Why Use This Configuration?
6
6
 
7
- - Consistency: Enforces a uniform coding style, minimizing code differences and easing collaboration.
8
- - Quality: Promotes best practices and helps avoid common pitfalls in JavaScript, TypeScript, and React development.
9
- - Automation: Reduces the need for manual code reviews by catching issues early in the development process.
10
- - Customization: While opinionated, it can be tailored to fit your project's specific needs.
11
-
12
- ## Links to Configurations
13
-
14
- - [jsEslint](./src/js/README.md): For JavaScript projects.
15
- - [tsEslint](./src/ts/README.md): For TypeScript projects.
16
- - [reactEslint](./src/react/README.md): For JavaScript and React projects.
17
- - [reactTsEslint](./src/react-ts/README.md): For TypeScript and React projects.
18
- - [nextEslint](./src/next/README.md): For JavaScript and Next projects.
19
- - [nextTsEslint](./src/next-ts/README.md): For TypeScript and Next projects.
20
- - [astroEslint](./src/astro/README.md): For JavaScript and Astro projects. (Beta)
21
- - [astroTsEslint](./src/astro-ts/README.md): For TypeScript and Astro projects. (Beta)
7
+ - **Consistency**: Enforces a uniform coding style, minimizing code differences and easing collaboration.
8
+ - **Quality**: Promotes best practices and helps avoid common pitfalls in JavaScript, TypeScript, and React development.
9
+ - **Automation**: Reduces the need for manual code reviews by catching issues early in the development process.
10
+ - **Customization**: While opinionated, it can be tailored to fit your project's specific needs.
22
11
 
23
12
  ## Installation
24
13
 
@@ -36,128 +25,108 @@ Then, install the configuration package:
36
25
 
37
26
  ## Usage
38
27
 
39
- ### For JavaScript Projects
40
-
41
- Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k`:
42
-
43
- ```js
44
- import { jsEslint } from '@santi020k/eslint-config-santi020k'
45
-
46
- export default [
47
- ...jsEslint,
48
- {
49
- // Other rules or overrides
50
- }
51
- ]
52
- ```
28
+ Create an eslint.config.js file (or use your existing one) and extend @santi020k/eslint-config-santi020k based on your project type:
53
29
 
54
- ### For TypeScript Projects
30
+ ### Basic Usage
55
31
 
56
- Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k` with TypeScript support:
32
+ For a basic JavaScript project:
57
33
 
58
34
  ```js
59
- import { tsConfig } from '@santi020k/eslint-config-santi020k'
35
+ import { eslintConfig } from './dist/index.mjs'
60
36
 
61
37
  export default [
62
- ...tsConfig,
63
- {
64
- // Other rules or overrides
65
- }
38
+ ...eslintConfig(),
39
+ // Your custom config
66
40
  ]
67
41
  ```
68
42
 
69
- ### For JavaScript and React Projects
43
+ ### Advanced Usage
70
44
 
71
- Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k`:
45
+ For projects with specific configurations (TypeScript, React, Next.js, etc.), use the appropriate options:
72
46
 
73
47
  ```js
74
- import { reactEslint } from '@santi020k/eslint-config-santi020k'
48
+ import { ConfigOptions, eslintConfig } from '@santi020k/eslint-config-santi020k';
75
49
 
76
- export default [
77
- ...reactEslint,
78
- {
79
- // Other rules or overrides
80
- }
81
- ]
82
- ```
83
-
84
- ### For TypeScript and React Projects
85
-
86
- Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k` with TypeScript support:
87
-
88
- ```js
89
- import { reactTsEslint } from '@santi020k/eslint-config-santi020k'
50
+ // Examples of different configurations
90
51
 
52
+ // TypeScript project
91
53
  export default [
92
- ...reactTsEslint,
93
- {
94
- // Other rules or overrides
95
- }
96
- ]
97
- ```
98
-
99
- ### For JavaScript and Next Projects
100
-
101
- Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k`:
102
-
103
- ```js
104
- import { nextEslint } from '@santi020k/eslint-config-santi020k'
54
+ ...eslintConfig({ config: [ConfigOptions.Ts] }),
55
+ // Your custom config
56
+ ];
105
57
 
58
+ // React project
106
59
  export default [
107
- ...nextEslint,
108
- {
109
- // Other rules or overrides
110
- }
111
- ]
112
- ```
60
+ ...eslintConfig({ config: [ConfigOptions.React] }),
61
+ // Your custom config
62
+ ];
113
63
 
114
- ### For TypeScript and Next Projects
115
-
116
- Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k` with TypeScript support:
117
-
118
- ```js
119
- import { nextTsEslint } from '@santi020k/eslint-config-santi020k'
64
+ // TypeScript and React project
65
+ export default [
66
+ ...eslintConfig({ config: [ConfigOptions.React, ConfigOptions.Ts] }),
67
+ // Your custom config
68
+ ];
120
69
 
70
+ // Next.js project
121
71
  export default [
122
- ...nextTsEslint,
123
- {
124
- // Other rules or overrides
125
- }
126
- ]
127
- ```
72
+ ...eslintConfig({ config: [ConfigOptions.Next] }),
73
+ // Your custom config
74
+ ];
128
75
 
129
- ### For JavaScript and Astro Projects
76
+ // TypeScript and Next.js project
77
+ export default [
78
+ ...eslintConfig({ config: [ConfigOptions.Next, ConfigOptions.Ts] }),
79
+ // Your custom config
80
+ ];
130
81
 
131
- (It is currently a beta implementation and only supports astro with react)
82
+ // Expo project (Beta)
83
+ export default [
84
+ ...eslintConfig({ config: [ConfigOptions.Expo] }),
85
+ // Your custom config
86
+ ];
132
87
 
133
- Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k`:
88
+ // TypeScript and Expo project (Beta)
89
+ export default [
90
+ ...eslintConfig({ config: [ConfigOptions.Expo, ConfigOptions.Ts] }),
91
+ // Your custom config
92
+ ];
134
93
 
135
- ```js
136
- import { astroEslint } from '@santi020k/eslint-config-santi020k'
94
+ // Astro project (beta, supports Astro with React)
95
+ export default [
96
+ ...eslintConfig({ config: [ConfigOptions.Astro] }),
97
+ // Your custom config
98
+ ];
137
99
 
100
+ // TypeScript and Astro project (beta, supports Astro with React)
138
101
  export default [
139
- ...astroEslint,
140
- {
141
- // Other rules or overrides
142
- }
143
- ]
102
+ ...eslintConfig({ config: [ConfigOptions.Astro, ConfigOptions.Ts] }),
103
+ // Your custom config
104
+ ];
144
105
  ```
145
106
 
146
- ### For TypeScript and Astro Projects
107
+ ### Optionals Usage
147
108
 
148
- (It is currently a beta implementation and only supports astro with react)
149
-
150
- Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k` with TypeScript support:
109
+ Additionally, there are some optional parameters that add support to other technologies that could be needed in a front-end project. The idea is to add support for more options in the future. Here is an example of how to use these optionals:
151
110
 
152
111
  ```js
153
- import { astroTsEslint } from '@santi020k/eslint-config-santi020k'
112
+ import { ConfigOptions, eslintConfig, OptionalOptions } from '@santi020k/eslint-config-santi020k';
154
113
 
155
114
  export default [
156
- ...astroTsEslint,
157
- {
158
- // Other rules or overrides
159
- }
160
- ]
115
+ ...eslintConfig({
116
+ config: [ConfigOptions.Next, ConfigOptions.Ts],
117
+ optionals: [
118
+ // Spell checker
119
+ OptionalOptions.Cspell,
120
+ // TailwindCss
121
+ OptionalOptions.Tailwind,
122
+ // Vitest and testing-library
123
+ OptionalOptions.Vitest,
124
+ // I18next
125
+ OptionalOptions.I18next
126
+ ]
127
+ }),
128
+ // Your custom config
129
+ ];
161
130
  ```
162
131
 
163
132
  ## Opinionated but Flexible
@@ -190,12 +159,15 @@ Here are some useful scripts you can add to your `package.json`:
190
159
 
191
160
  4. Adjust as Necessary: Review the linting rules and adjust them based on your project's needs. Since this configuration is opinionated, some rules might be too strict or not applicable to your project. Feel free to disable or modify them.
192
161
 
193
- ## Future
162
+ ## Future Features
194
163
 
195
- [ ] Unit testing
196
- [ ] Better documentation
197
- [ ] Additional Frameworks support
198
- [ ] Refactor rules structure (eslint configurations are currently duplicated)
164
+ - [ ] Unit testing
165
+ - [ ] Better documentation
166
+ - [ ] Additional Frameworks support
167
+ - [ ] Vue
168
+ - [ ] Angular
169
+ - [ ] Astro (Process)
170
+ - [X] Refactor rules structure (eslint configurations are currently duplicated)
199
171
 
200
172
  ## Contributing
201
173
 
@@ -217,7 +189,10 @@ I would like to express my gratitude to the developers and maintainers of the fo
217
189
  - `eslint-plugin-unused-imports`
218
190
  - `@stylistic/eslint-plugin`
219
191
  - `@typescript-eslint`
220
- - etc...
192
+ - `@cspell/eslint-plugin`
193
+ - `eslint-plugin-tailwindcss`
194
+ - `eslint-plugin-vitest`
195
+ - `etc...`
221
196
 
222
197
  These tools have significantly contributed to the JavaScript and TypeScript ecosystem, and their continued development helps maintain the high standards of code quality that we all strive for.
223
198
 
@@ -0,0 +1,9 @@
1
+ declare const astroConfig: (import("eslint").Linter.FlatConfig<import("eslint").Linter.RulesRecord> | {
2
+ name: string;
3
+ rules: {
4
+ 'simple-import-sort/imports': (string | {
5
+ groups: string[][];
6
+ })[];
7
+ };
8
+ })[];
9
+ export { astroConfig };
@@ -0,0 +1,6 @@
1
+ declare const rules: {
2
+ 'simple-import-sort/imports': (string | {
3
+ groups: string[][];
4
+ })[];
5
+ };
6
+ export { rules };
@@ -0,0 +1,9 @@
1
+ declare const expoConfig: (import("eslint").Linter.FlatConfig<import("eslint").Linter.RulesRecord> | {
2
+ name: string;
3
+ rules: {
4
+ 'simple-import-sort/imports': (string | {
5
+ groups: string[][];
6
+ })[];
7
+ };
8
+ })[];
9
+ export { expoConfig };
@@ -0,0 +1,6 @@
1
+ declare const rules: {
2
+ 'simple-import-sort/imports': (string | {
3
+ groups: string[][];
4
+ })[];
5
+ };
6
+ export { rules };
@@ -0,0 +1,6 @@
1
+ export { astroConfig } from './astro/index.config';
2
+ export { jsConfig } from './js/index.config';
3
+ export { nextConfig } from './next/index.config';
4
+ export { reactConfig } from './react/index.config';
5
+ export { tsConfig } from './ts/index.config';
6
+ export { expoConfig } from './expo/index.config';
@@ -0,0 +1,3 @@
1
+ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const jsConfig: FlatConfig.ConfigArray;
3
+ export { jsConfig };
@@ -0,0 +1,4 @@
1
+ import { Linter } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const groups: string[][];
3
+ declare const rules: Linter.RulesRecord;
4
+ export { rules, groups };
@@ -0,0 +1,9 @@
1
+ declare const nextConfig: (import("eslint").Linter.FlatConfig<import("eslint").Linter.RulesRecord> | {
2
+ name: string;
3
+ rules: {
4
+ 'simple-import-sort/imports': (string | {
5
+ groups: string[][];
6
+ })[];
7
+ };
8
+ })[];
9
+ export { nextConfig };
@@ -0,0 +1,6 @@
1
+ declare const rules: {
2
+ 'simple-import-sort/imports': (string | {
3
+ groups: string[][];
4
+ })[];
5
+ };
6
+ export { rules };
@@ -0,0 +1,11 @@
1
+ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const reactConfig: (FlatConfig.Config | {
3
+ name: string;
4
+ plugins: {
5
+ 'react-hooks': any;
6
+ };
7
+ languageOptions: any;
8
+ files: string[];
9
+ rules: any;
10
+ })[];
11
+ export { reactConfig };
@@ -0,0 +1,3 @@
1
+ import { Linter } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const rules: Linter.RulesRecord;
3
+ export { rules };
@@ -0,0 +1,3 @@
1
+ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const tsConfig: FlatConfig.Config[];
3
+ export { tsConfig };
@@ -0,0 +1,25 @@
1
+ declare const rules: {
2
+ semi: string;
3
+ 'no-unused-vars': string;
4
+ '@typescript-eslint/indent': string;
5
+ '@typescript-eslint/no-unused-vars': (string | {
6
+ vars: string;
7
+ varsIgnorePattern: string;
8
+ args: string;
9
+ argsIgnorePattern: string;
10
+ destructuredArrayIgnorePattern: string;
11
+ ignoreRestSiblings: boolean;
12
+ })[];
13
+ '@typescript-eslint/no-explicit-any': string;
14
+ '@typescript-eslint/no-empty-function': string;
15
+ '@typescript-eslint/ban-types': string;
16
+ '@typescript-eslint/no-var-requires': string;
17
+ '@typescript-eslint/ban-ts-comment': string;
18
+ '@typescript-eslint/no-non-null-assertion': string;
19
+ '@typescript-eslint/no-invalid-void-type': string;
20
+ '@typescript-eslint/no-dynamic-delete': string;
21
+ '@typescript-eslint/no-useless-constructor': string;
22
+ '@typescript-eslint/prefer-for-of': string;
23
+ '@typescript-eslint/no-duplicate-enum-values': string;
24
+ };
25
+ export { rules };
@@ -0,0 +1,20 @@
1
+ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
2
+ declare enum ConfigOptions {
3
+ Ts = "ts",
4
+ React = "react",
5
+ Next = "next",
6
+ Expo = "expo",
7
+ Astro = "astro"
8
+ }
9
+ declare enum OptionalOptions {
10
+ Cspell = "cspell",
11
+ Tailwind = "tailwind",
12
+ Vitest = "vitest",
13
+ I18next = "i18next"
14
+ }
15
+ interface EslintConfig {
16
+ config?: ConfigOptions[];
17
+ optionals?: OptionalOptions[];
18
+ }
19
+ declare const eslintConfig: ({ config, optionals }?: EslintConfig) => FlatConfig.ConfigArray;
20
+ export { ConfigOptions, eslintConfig, OptionalOptions };