@commencis/eslint-config 2.5.0 → 3.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @commencis/eslint-config
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: export paths ([#416](https://github.com/Commencis/js-toolkit/pull/416))
8
+
9
+ ## 3.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [BreakingChange]: Introducing v3 - With cleaner dependencies and structure. Check readme files for implementations. ([#414](https://github.com/Commencis/js-toolkit/pull/414))
14
+
3
15
  ## 2.5.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -29,74 +29,72 @@ pnpm add --save-dev eslint @commencis/eslint-config
29
29
  > [!IMPORTANT]
30
30
  > All the configs provided by this package is for the new [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new) that supported with `ESLint >= v9`
31
31
 
32
- This package provides `defineConfig` function and includes config sets and can be found in package exports as following,
32
+ Access the `defineConfig` function directly from this package, or import it from `eslint/config` as needed.
33
33
 
34
- - Commencis Base: `commencisBaseConfig`
35
- - Typescript: `commencisTypescriptConfig`
36
- - React: `commencisReactConfig`
37
- - NextJs: `commencisNextConfig`
38
- - Vue: `commencisVueConfig`
39
- - Prettier: `commencisPrettierConfig`
34
+ ## Configs & Helper Exports
40
35
 
41
- Firstly create your `eslint.config.js` and use the desired config by your project.
36
+ This package includes pre-configured configs for:
42
37
 
43
- ### Example Usage for React/Typescript Project:
38
+ - **Javascript**
39
+ - **Typescript**
40
+ - **React**
41
+ - **NextJs**
42
+ - **ReactNative**
44
43
 
45
- ```javascript
46
- // eslint.config.js
47
- import { commencisReactConfig, defineConfig } from '@commencis/eslint-config';
48
-
49
- export default defineConfig(...commencisReactConfig, {
50
- /* ... */
51
- });
52
- ```
44
+ To use the default rules without additional customization, export the base configuration as shown below:
53
45
 
54
- ### Example Usage for React-Native/Typescript Project:
46
+ ### Basic Usage without Overrides
55
47
 
56
48
  ```javascript
57
- // eslint.config.js
58
- import {
59
- commencisReactNativeConfig,
60
- defineConfig,
61
- } from '@commencis/eslint-config';
62
-
63
- export default defineConfig(...commencisReactNativeConfig, {
64
- /* ... */
65
- });
49
+ // eslint.config.mjs
50
+ export { default } from '@commencis/eslint-config/react';
66
51
  ```
67
52
 
68
- ### Example Usage for NextJs/Typescript Project:
53
+ Default export is available on:
69
54
 
70
- ```javascript
71
- // eslint.config.js
72
- import { commencisNextConfig, defineConfig } from '@commencis/eslint-config';
55
+ - `@commencis/eslint-config/javascript`;
56
+ - `@commencis/eslint-config/typescript`;
57
+ - `@commencis/eslint-config/react`;
58
+ - `@commencis/eslint-config/next`;
59
+ - `@commencis/eslint-config/native`;
73
60
 
74
- export default defineConfig(...commencisNextConfig, {
75
- ignores: ['.next/', 'next.config.js', 'next-env.d.ts'],
76
- });
77
- ```
61
+ ### Flexible Usage with Overrides
78
62
 
79
- ### Example Usage for Vue/Typescript Project:
63
+ Alternatively, to use overrides:
80
64
 
81
- ```javascript
82
- // eslint.config.js
83
- import { commencisVueConfig, defineConfig } from '@commencis/eslint-config';
65
+ Find desired named exports:
84
66
 
85
- export default defineConfig(...commencisVueConfig);
86
- ```
67
+ - `javascriptConfig`
68
+ - `typescriptConfig`
69
+ - `reactConfig`
70
+ - `nextConfig`
71
+ - `reactNativeConfig`
87
72
 
88
- `React, NextJs, Vue` configs include `base, typescript, prettier` configs as bundle. You dont have to add them seperately. But also override any rules by your needs.
73
+ ```javascript
74
+ // eslint.config.mjs
75
+ export { nextConfig, defineConfig } from '@commencis/eslint-config';
89
76
 
90
- ### Partial Imports
77
+ export default defineConfig(next, {
78
+ // overrides
79
+ });
80
+ ```
91
81
 
92
- You can also import the configs seperately and merge them if needed on specific cases.
82
+ ### New `configFactory` Usage with Overrides:
93
83
 
94
84
  ```javascript
95
- // eslint.config.js
96
- import baseConfig from '@commencis/eslint-config/base';
97
- import typescriptConfig from '@commencis/eslint-config/typescript';
85
+ // eslint.config.mjs
86
+ export { configFactory, defineConfig } from '@commencis/eslint-config';
87
+
88
+ const config = configFactory({
89
+ react: true,
90
+ next: true,
91
+ jsxA11y: true,
92
+ reactCompiler: true,
93
+ });
98
94
 
99
- export default [...baseConfig, ...typescriptConfig];
95
+ export default defineConfig(config, {
96
+ // overrides
97
+ });
100
98
  ```
101
99
 
102
100
  ## References
@@ -1,4 +1,6 @@
1
- import { Linter } from 'eslint';
1
+ import { Linter } from "eslint";
2
+
3
+ //#region src/types/config.types.d.ts
2
4
 
3
5
  /**
4
6
  * Relax plugins type limitation,
@@ -10,9 +12,13 @@ import { Linter } from 'eslint';
10
12
  * @see Using plugins in your configuration]
11
13
  * (https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
12
14
  */
13
- type FlatConfig = Omit<Linter.Config, 'plugins'> & {
14
- plugins?: Record<string, unknown>;
15
+ /**
16
+ * Plugin relaxation reverted temporarily,
17
+ * which causes type errors in the config files.
18
+ */
19
+ type Ruleset = Linter.Config & {
20
+ name: string;
15
21
  };
16
- type FlatConfigArray = FlatConfig[];
17
-
18
- export type { FlatConfig as F, FlatConfigArray as a };
22
+ type FlatConfig = Ruleset[];
23
+ //#endregion
24
+ export { FlatConfig as t };