@aliexme/eslint-config 0.4.3 → 1.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
@@ -4,95 +4,75 @@ Rule set for ESLint
4
4
 
5
5
  ## Installation
6
6
 
7
- ```
8
- npm i --save-dev eslint @aliexme/eslint-config eslint-plugin-import
7
+ ```sh
8
+ npm i --save-dev eslint @aliexme/eslint-config
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
13
  Extend your ESLint config file:
14
14
 
15
- ```
16
- {
17
- "extends": [
18
- "@aliexme/eslint-config",
19
- ],
20
- }
21
- ```
22
-
23
- ### Typescript
24
-
25
- To check ts-files, install additional packages:
26
-
27
- ```
28
- npm i --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin
29
- ```
30
-
31
- And add the following lines to your ESLint config file:
15
+ ```js
16
+ import eslintConfigRecommended from '@aliexme/eslint-config'
32
17
 
33
- ```
34
- {
35
- "extends": [
36
- "@aliexme/eslint-config",
37
- "@aliexme/eslint-config/typescript",
38
- ],
39
- }
18
+ export default [
19
+ ...eslintConfigRecommended, // <--
20
+ ]
40
21
  ```
41
22
 
42
23
  ### React
43
24
 
44
25
  Install additional packages:
45
26
 
46
- ```
27
+ ```sh
47
28
  npm i --save-dev eslint-plugin-react eslint-plugin-react-hooks
48
29
  ```
49
30
 
50
31
  And add the following lines to your ESLint config file:
51
32
 
52
- ```
53
- {
54
- "extends": [
55
- "@aliexme/eslint-config",
56
- "@aliexme/eslint-config/react",
57
- "plugin:react-hooks/recommended",
58
- ],
59
- }
33
+ ```js
34
+ import eslintConfigReact from '@aliexme/eslint-config/react'
35
+
36
+ export default [
37
+ ...eslintConfigRecommended,
38
+ ...eslintConfigReact, // <--
39
+ ]
60
40
  ```
61
41
 
62
42
  ### React Native
63
43
 
64
44
  Install additional packages:
65
45
 
66
- ```
46
+ ```sh
67
47
  npm i --save-dev eslint-plugin-react-native
68
48
  ```
69
49
 
70
50
  And add the following lines to your ESLint config file:
71
51
 
72
- ```
73
- {
74
- "extends": [
75
- "@aliexme/eslint-config",
76
- "@aliexme/eslint-config/react-native",
77
- ],
78
- }
52
+ ```js
53
+ import eslintConfigReactNative from '@aliexme/eslint-config/react-native'
54
+
55
+ export default [
56
+ ...eslintConfigRecommended,
57
+ ...eslintConfigReactNative, // <--
58
+ ]
79
59
  ```
80
60
 
81
61
  ### Prettier
82
62
 
83
63
  Install additional packages:
84
64
 
85
- ```
65
+ ```sh
86
66
  npm i --save-dev prettier eslint-plugin-prettier eslint-config-prettier
87
67
  ```
88
68
 
89
69
  And add the following lines to your ESLint config file:
90
70
 
91
- ```
92
- {
93
- "extends": [
94
- "@aliexme/eslint-config",
95
- "@aliexme/eslint-config/prettier",
96
- ],
97
- }
71
+ ```js
72
+ import eslintConfigPrettier from '@aliexme/eslint-config/prettier'
73
+
74
+ export default [
75
+ ...eslintConfigRecommended,
76
+ ...eslintConfigPrettier, // <--
77
+ ]
98
78
  ```
@@ -0,0 +1,3 @@
1
+ import { FlatCompat } from '@eslint/eslintrc';
2
+ export declare const compat: FlatCompat;
3
+ export declare const legacyPlugin: (name: string, alias?: string) => import("eslint").ESLint.Plugin;
package/dist/compat.js ADDED
@@ -0,0 +1,11 @@
1
+ import { FlatCompat } from '@eslint/eslintrc';
2
+ import { fixupPluginRules } from '@eslint/compat';
3
+ export const compat = new FlatCompat();
4
+ export const legacyPlugin = (name, alias = name) => {
5
+ const plugin = compat.plugins(name)[0]?.plugins?.[alias];
6
+ if (!plugin) {
7
+ throw new Error(`Unable to resolve plugin ${name} and/or alias ${alias}`);
8
+ }
9
+ return fixupPluginRules(plugin);
10
+ };
11
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../src/compat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAA;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,KAAK,GAAG,IAAI,EAAE,EAAE;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;IAExD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,iBAAiB,KAAK,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAA;AACjC,CAAC,CAAA"}