rslint-config-cozy-app 0.2.0 → 0.3.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 +14 -0
- package/node-esm.js +11 -0
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -45,8 +45,22 @@ Then in `package.json`:
|
|
|
45
45
|
- `noUnusedVarsOptions`: the options of the `no-unused-vars` rules;
|
|
46
46
|
- `testFiles`: the globs of test files (`*.spec.*`, `*.test.*` and the files under `__tests__/`).
|
|
47
47
|
- `rslint-config-cozy-app/react`: function returning `basics` plus the React, React Hooks and type-aware TypeScript rules. The React rules apply to `.js`, `.jsx` and `.tsx` files. The TypeScript rules apply to `.ts`, `.tsx`, `.mts` and `.cts` files, with `projectService: true`.
|
|
48
|
+
- `rslint-config-cozy-app/node-esm`: opt-in function returning the rule `node/file-extension-in-import`, for a package published as ES modules that Node loads as is. Node refuses a relative import without its extension; an app bundled by rsbuild or webpack does not need it.
|
|
48
49
|
- `rslint-config-cozy-app/fmt`: the formatting options for `define.fmt()`.
|
|
49
50
|
|
|
51
|
+
## Packages published as ES modules
|
|
52
|
+
|
|
53
|
+
Add `node-esm` after the other presets:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import nodeEsm from 'rslint-config-cozy-app/node-esm'
|
|
57
|
+
import react from 'rslint-config-cozy-app/react'
|
|
58
|
+
|
|
59
|
+
define.lint(lint => [...react(lint), ...nodeEsm()])
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`rs lint --fix` adds the missing extensions.
|
|
63
|
+
|
|
50
64
|
## Extend `import/order`
|
|
51
65
|
|
|
52
66
|
Spread `importOrderOptions` and rebuild `pathGroups`:
|
package/node-esm.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// For a package published as ES modules that Node loads as is: Node refuses a
|
|
2
|
+
// relative import without its extension. Apps bundled by rsbuild or webpack
|
|
3
|
+
// import without extensions, so this preset is opt-in.
|
|
4
|
+
export default function nodeEsm() {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
plugins: ['node'],
|
|
8
|
+
rules: { 'node/file-extension-in-import': ['error', 'always'] }
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rslint-config-cozy-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Rslint and rs fmt config for Cozy Applications (Cozy Cloud)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Cozy Cloud",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/linagora/cozy-libs.git",
|
|
10
|
+
"directory": "config/rslint-config-cozy-app"
|
|
10
11
|
},
|
|
11
|
-
"homepage": "https://github.com/
|
|
12
|
+
"homepage": "https://github.com/linagora/cozy-libs/tree/master/config/rslint-config-cozy-app",
|
|
12
13
|
"license": "MIT",
|
|
13
14
|
"bugs": {
|
|
14
|
-
"url": "https://github.com/
|
|
15
|
+
"url": "https://github.com/linagora/cozy-libs/issues"
|
|
15
16
|
},
|
|
16
17
|
"exports": {
|
|
17
18
|
".": "./index.js",
|
|
18
19
|
"./basics": "./basics.js",
|
|
19
20
|
"./react": "./react.js",
|
|
21
|
+
"./node-esm": "./node-esm.js",
|
|
20
22
|
"./fmt": "./fmt.js"
|
|
21
23
|
},
|
|
22
24
|
"files": [
|
|
23
25
|
"index.js",
|
|
24
26
|
"basics.js",
|
|
25
27
|
"react.js",
|
|
28
|
+
"node-esm.js",
|
|
26
29
|
"fmt.js"
|
|
27
30
|
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "node --test test/node-esm.spec.js"
|
|
33
|
+
},
|
|
28
34
|
"peerDependencies": {
|
|
29
35
|
"rstack": ">=0.8.5 <0.9.0"
|
|
30
36
|
},
|
|
31
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "21e6eb7423f854fdfcea6846d76597543f96d2ba"
|
|
32
38
|
}
|