eslint-stylistic-airbnb 1.0.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 +37 -4
- package/index.js +10 -8
- package/package.json +2 -2
- package/rules/style.js +5 -1
package/README.md
CHANGED
|
@@ -13,12 +13,13 @@ npm install -D eslint @stylistic/eslint-plugin eslint-stylistic-airbnb
|
|
|
13
13
|
Add following to your eslint config:
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
16
|
-
// Flat config
|
|
16
|
+
// Flat config
|
|
17
|
+
// eslint.config.mjs
|
|
17
18
|
import stylistic from '@stylistic/eslint-plugin';
|
|
18
19
|
import airbnb from 'eslint-stylistic-airbnb';
|
|
19
20
|
|
|
20
21
|
export default [
|
|
21
|
-
|
|
22
|
+
airbnb,
|
|
22
23
|
{
|
|
23
24
|
files: ['**/*.{js,mjs,cjs,ts}'],
|
|
24
25
|
plugins: {
|
|
@@ -28,6 +29,22 @@ export default [
|
|
|
28
29
|
];
|
|
29
30
|
```
|
|
30
31
|
|
|
32
|
+
```javascript
|
|
33
|
+
// Legacy config
|
|
34
|
+
// .eslintrc.js
|
|
35
|
+
module.exports = {
|
|
36
|
+
plugins: ['@stylistic'],
|
|
37
|
+
rules: {
|
|
38
|
+
...require('eslint-stylistic-airbnb').rules,
|
|
39
|
+
},
|
|
40
|
+
parserOptions: {
|
|
41
|
+
ecmaVersion: 'latest',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
# TypeScript
|
|
47
|
+
|
|
31
48
|
If you use typescript, install additional dependency:
|
|
32
49
|
|
|
33
50
|
```shell
|
|
@@ -37,13 +54,14 @@ npm install -D typescript-eslint
|
|
|
37
54
|
And add following to your eslint config:
|
|
38
55
|
|
|
39
56
|
```javascript
|
|
40
|
-
// Flat config
|
|
57
|
+
// Flat config
|
|
58
|
+
// eslint.config.mjs
|
|
41
59
|
import tseslint from 'typescript-eslint';
|
|
42
60
|
import stylistic from '@stylistic/eslint-plugin';
|
|
43
61
|
import airbnb from 'eslint-stylistic-airbnb';
|
|
44
62
|
|
|
45
63
|
export default [
|
|
46
|
-
|
|
64
|
+
airbnb,
|
|
47
65
|
...tseslint.configs.recommended,
|
|
48
66
|
{
|
|
49
67
|
files: ['**/*.{js,mjs,cjs,ts}'],
|
|
@@ -54,6 +72,21 @@ export default [
|
|
|
54
72
|
];
|
|
55
73
|
```
|
|
56
74
|
|
|
75
|
+
```javascript
|
|
76
|
+
// Legacy config
|
|
77
|
+
// .eslintrc.js
|
|
78
|
+
module.exports = {
|
|
79
|
+
plugins: [
|
|
80
|
+
'@typescript-eslint',
|
|
81
|
+
'@stylistic',
|
|
82
|
+
],
|
|
83
|
+
parser: '@typescript-eslint/parser',
|
|
84
|
+
rules: {
|
|
85
|
+
...require('eslint-stylistic-airbnb').rules,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
```
|
|
89
|
+
|
|
57
90
|
# Notes
|
|
58
91
|
|
|
59
92
|
This config is created from the base airbnb config as is, with no changes to original rules
|
package/index.js
CHANGED
|
@@ -5,11 +5,13 @@ const strict = require('./rules/strict.js');
|
|
|
5
5
|
const style = require('./rules/style.js');
|
|
6
6
|
const variables = require('./rules/variables.js');
|
|
7
7
|
|
|
8
|
-
module.exports =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
module.exports = {
|
|
9
|
+
rules: {
|
|
10
|
+
...bestPractices.rules,
|
|
11
|
+
...errors.rules,
|
|
12
|
+
...es6.rules,
|
|
13
|
+
...strict.rules,
|
|
14
|
+
...style.rules,
|
|
15
|
+
...variables.rules,
|
|
16
|
+
},
|
|
17
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-stylistic-airbnb",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Airbnb config for eslint using stylistic plugin",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"confusing-browser-globals": "^1.0.11"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"eslint": ">=8.
|
|
28
|
+
"eslint": ">=8.57.0",
|
|
29
29
|
"@stylistic/eslint-plugin": ">=2.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/rules/style.js
CHANGED
|
@@ -43,13 +43,17 @@ module.exports = {
|
|
|
43
43
|
|
|
44
44
|
// require trailing commas in multiline object literals
|
|
45
45
|
// https://eslint.org/docs/rules/comma-dangle
|
|
46
|
-
// https://eslint.style/rules/
|
|
46
|
+
// https://eslint.style/rules/default/comma-dangle
|
|
47
47
|
'@stylistic/comma-dangle': ['error', {
|
|
48
48
|
arrays: 'always-multiline',
|
|
49
49
|
objects: 'always-multiline',
|
|
50
50
|
imports: 'always-multiline',
|
|
51
51
|
exports: 'always-multiline',
|
|
52
52
|
functions: 'always-multiline',
|
|
53
|
+
// ts specific values https://eslint.style/rules/default/comma-dangle#ts-comma-dangle
|
|
54
|
+
enums: 'always-multiline',
|
|
55
|
+
generics: 'always-multiline',
|
|
56
|
+
tuples: 'always-multiline',
|
|
53
57
|
}],
|
|
54
58
|
|
|
55
59
|
// enforce spacing before and after comma
|