@robinblomberg/eslint-config-robinblomberg 0.35.0 → 0.36.0-beta2
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 +52 -52
- package/dist/index.d.ts.map +1 -0
- package/dist/rules/comment-style.d.ts +6 -0
- package/dist/rules/comment-style.d.ts.map +1 -0
- package/dist/rules/index.d.ts +8 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/module-declarations.d.ts +23 -0
- package/dist/rules/module-declarations.d.ts.map +1 -0
- package/dist/rules/prefer-arrow-functions.d.ts +6 -0
- package/dist/rules/prefer-arrow-functions.d.ts.map +1 -0
- package/dist/rules/sort-declarations.d.ts +7 -0
- package/dist/rules/sort-declarations.d.ts.map +1 -0
- package/dist/rules/sort-tests.d.ts +6 -0
- package/dist/rules/sort-tests.d.ts.map +1 -0
- package/package.json +17 -11
- package/{index.js → src/index.js} +285 -176
- package/src/rules/comment-style.js +298 -0
- package/src/rules/index.js +23 -0
- package/src/rules/module-declarations.js +278 -0
- package/src/rules/prefer-arrow-functions.js +296 -0
- package/src/rules/sort-declarations.js +318 -0
- package/src/rules/sort-tests.js +102 -0
- package/index.d.ts.map +0 -1
- /package/{index.d.ts → dist/index.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
# ESLint config
|
|
2
|
-
|
|
3
|
-
## Installation
|
|
4
|
-
|
|
5
|
-
```sh
|
|
6
|
-
npm install -D @robinblomberg/eslint-config-robinblomberg
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## Configuration
|
|
10
|
-
|
|
11
|
-
Requires ESLint 9.x and Node's `require(esm)`/ESM support.
|
|
12
|
-
|
|
13
|
-
Create a file called **eslint.config.js** at the project root:
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import eslintConfigRobinBlomberg from '@robinblomberg/eslint-config-robinblomberg';
|
|
17
|
-
|
|
18
|
-
export default [...eslintConfigRobinBlomberg];
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
If your project isn't set up for ESM (no `"type": "module"` in package.json), name the file **eslint.config.mjs** instead.
|
|
22
|
-
|
|
23
|
-
## NPM scripts
|
|
24
|
-
|
|
25
|
-
Add the following scripts to your package.json:
|
|
26
|
-
|
|
27
|
-
```json
|
|
28
|
-
{
|
|
29
|
-
"scripts": {
|
|
30
|
-
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
|
|
31
|
-
"lint:fix": "eslint \"**/*.{js,jsx,ts,tsx}\" --fix"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Adjust the paths according to your project/file structure as necessary (e.g. `"eslint \"lib/**/*.{ts,tsx}\""`).
|
|
37
|
-
|
|
38
|
-
To run a script, enter the following in your command line:
|
|
39
|
-
|
|
40
|
-
```sh
|
|
41
|
-
npm run lint
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Formatting on save
|
|
45
|
-
|
|
46
|
-
With this knowledge of ESLint messages in mind, we can modify VS Code to tell ESLint to fix any issues (mainly formatting) every time we save. To open the settings menu, click on the gear icon in the lower left, and then choose **Settings**.
|
|
47
|
-
|
|
48
|
-
Within the settings menu, search for eslint. In the results, you will see a checkbox for **ESLint: Auto Fix on Save**. Make sure this is checked:
|
|
49
|
-
|
|
50
|
-

|
|
51
|
-
|
|
52
|
-
Now, save your JavaScript file. You should see some changes, including fewer squiggles.
|
|
1
|
+
# ESLint config
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -D @robinblomberg/eslint-config-robinblomberg
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Configuration
|
|
10
|
+
|
|
11
|
+
Requires ESLint 9.x and Node's `require(esm)`/ESM support.
|
|
12
|
+
|
|
13
|
+
Create a file called **eslint.config.js** at the project root:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import eslintConfigRobinBlomberg from '@robinblomberg/eslint-config-robinblomberg';
|
|
17
|
+
|
|
18
|
+
export default [...eslintConfigRobinBlomberg];
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If your project isn't set up for ESM (no `"type": "module"` in package.json), name the file **eslint.config.mjs** instead.
|
|
22
|
+
|
|
23
|
+
## NPM scripts
|
|
24
|
+
|
|
25
|
+
Add the following scripts to your package.json:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"scripts": {
|
|
30
|
+
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
|
|
31
|
+
"lint:fix": "eslint \"**/*.{js,jsx,ts,tsx}\" --fix"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Adjust the paths according to your project/file structure as necessary (e.g. `"eslint \"lib/**/*.{ts,tsx}\""`).
|
|
37
|
+
|
|
38
|
+
To run a script, enter the following in your command line:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npm run lint
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Formatting on save
|
|
45
|
+
|
|
46
|
+
With this knowledge of ESLint messages in mind, we can modify VS Code to tell ESLint to fix any issues (mainly formatting) every time we save. To open the settings menu, click on the gear icon in the lower left, and then choose **Settings**.
|
|
47
|
+
|
|
48
|
+
Within the settings menu, search for eslint. In the results, you will see a checkbox for **ESLint: Auto Fix on Save**. Make sure this is checked:
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
Now, save your JavaScript file. You should see some changes, including fewer squiggles.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AA0CA;;GAEG;AACH,sBAFU,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAunDxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-style.d.ts","sourceRoot":"","sources":["../../src/rules/comment-style.js"],"names":[],"mappings":";AAYA;;GAEG;AACH,oBAFU,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU,CAuOxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rules/index.js"],"names":[],"mappings":";AAKA;;;;GAIG;AACH,sBAFU,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,CAYtC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const GROUP_NAMES: string[];
|
|
2
|
+
export namespace GROUPS {
|
|
3
|
+
let _class: number;
|
|
4
|
+
export { _class as class };
|
|
5
|
+
export let constant: number;
|
|
6
|
+
let _function: number;
|
|
7
|
+
export { _function as function };
|
|
8
|
+
export let type: number;
|
|
9
|
+
export let variable: number;
|
|
10
|
+
}
|
|
11
|
+
export function compareNames(first: string, second: string): number;
|
|
12
|
+
export function getDeclaration(statement: any): Declaration | undefined;
|
|
13
|
+
export function getDeclarationRuns(statements: any[]): Declaration[][];
|
|
14
|
+
export function getLoadTimeDependencies(sourceCode: import("eslint").SourceCode, declarations: Declaration[]): Map<Declaration, Set<Declaration>>;
|
|
15
|
+
export function getModuleVariable(sourceCode: import("eslint").SourceCode, name: string): import("eslint").Scope.Variable | undefined;
|
|
16
|
+
export function isLoadTimeReference(sourceCode: import("eslint").SourceCode, identifier: any, statement: any): boolean;
|
|
17
|
+
export type Declaration = {
|
|
18
|
+
group: number;
|
|
19
|
+
name: string;
|
|
20
|
+
node: any;
|
|
21
|
+
statement: any;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=module-declarations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-declarations.d.ts","sourceRoot":"","sources":["../../src/rules/module-declarations.js"],"names":[],"mappings":"AAMA,mCAOE;;;;;;;;;;AA8BK,oCAJI,MAAM,UACN,MAAM,GACL,MAAM,CAIjB;AASM,0CAHI,GAAG,GACF,WAAW,GAAG,SAAS,CA0DlC;AASM,+CAHI,GAAG,EAAE,GACJ,WAAW,EAAE,EAAE,CAwB1B;AAYM,oDAJI,OAAO,QAAQ,EAAE,UAAU,gBAC3B,WAAW,EAAE,GACZ,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAwE7C;AASM,8CAJI,OAAO,QAAQ,EAAE,UAAU,QAC3B,MAAM,GACL,OAAO,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAG,SAAS,CAUtD;AAWM,gDALI,OAAO,QAAQ,EAAE,UAAU,cAC3B,GAAG,aACH,GAAG,GACF,OAAO,CA4BlB;0BArQY;IACR,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,GAAG,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-arrow-functions.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-arrow-functions.js"],"names":[],"mappings":";AAMA;;GAEG;AACH,oBAFU,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU,CAmHxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-declarations.d.ts","sourceRoot":"","sources":["../../src/rules/sort-declarations.js"],"names":[],"mappings":";0BA4Oa,OAAO,0BAA0B,EAAE,WAAW;AAnO3D;;GAEG;AACH,oBAFU,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU,CA+NxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-tests.d.ts","sourceRoot":"","sources":["../../src/rules/sort-tests.js"],"names":[],"mappings":";AAIA;;GAEG;AACH,oBAFU,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU,CA0DxC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robinblomberg/eslint-config-robinblomberg",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0-beta2",
|
|
4
4
|
"author": "Robin Blomberg",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./src/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
7
13
|
"type": "module",
|
|
8
14
|
"files": [
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
15
|
+
"dist",
|
|
16
|
+
"src",
|
|
17
|
+
"!src/**/*.test.js"
|
|
12
18
|
],
|
|
13
19
|
"repository": {
|
|
14
20
|
"type": "git",
|
|
@@ -20,9 +26,10 @@
|
|
|
20
26
|
"homepage": "https://github.com/RobinBlomberg/eslint-config-robinblomberg#readme",
|
|
21
27
|
"scripts": {
|
|
22
28
|
"build": "tsc -p tsconfig.build.json",
|
|
23
|
-
"lint": "eslint
|
|
24
|
-
"lint:fix": "eslint
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"lint:fix": "eslint . --fix",
|
|
25
31
|
"prepack": "npm run build",
|
|
32
|
+
"test": "node src/rules/rules.test.js && node src/config.test.js",
|
|
26
33
|
"typecheck": "tsc"
|
|
27
34
|
},
|
|
28
35
|
"dependencies": {
|
|
@@ -34,18 +41,17 @@
|
|
|
34
41
|
"eslint-plugin-jsdoc": "^64.3.4",
|
|
35
42
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
36
43
|
"eslint-plugin-no-only-tests": "^3.4.0",
|
|
44
|
+
"eslint-plugin-perfectionist": "^5.14.0",
|
|
37
45
|
"eslint-plugin-react": "^7.37.5",
|
|
38
46
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
39
47
|
"eslint-plugin-react-refresh": "^0.5.6",
|
|
40
48
|
"eslint-plugin-sonarjs": "^4.2.0",
|
|
41
|
-
"eslint-plugin-sort-exports": "^0.9.1",
|
|
42
|
-
"eslint-plugin-sort-keys": "^2.3.5",
|
|
43
49
|
"eslint-plugin-storybook": "^10.6.0",
|
|
44
50
|
"eslint-plugin-unicorn": "^65.0.1",
|
|
45
51
|
"globals": "^17.12.0"
|
|
46
52
|
},
|
|
47
53
|
"devDependencies": {
|
|
48
|
-
"@robinblomberg/eslint-config-prettier": "^0.
|
|
54
|
+
"@robinblomberg/eslint-config-prettier": "^0.3.0",
|
|
49
55
|
"@robinblomberg/eslint-config-robinblomberg": "^0.34.0",
|
|
50
56
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
51
57
|
"@types/node": "*",
|