Skip to content

Commit 9f7260c

Browse files
authored
Merge pull request #123 from acelaya-forks/feature/fix-definitions
Fix rules definitions coming from plugins or shareable configs
2 parents 8ec6bc7 + c34d620 commit 9f7260c

File tree

4 files changed

+44
-16
lines changed

4 files changed

+44
-16
lines changed

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org).
66

7+
## [3.2.1] - 2024-10-22
8+
#### Added
9+
* *Nothing*
10+
11+
#### Changed
12+
* *Nothing*
13+
14+
#### Deprecated
15+
* *Nothing*
16+
17+
#### Removed
18+
* *Nothing*
19+
20+
#### Fixed
21+
* Fix rules definitions coming from plugins or shareable configs.
22+
23+
724
## [3.2.0] - 2024-10-12
825
#### Added
926
* Add support for `eslint-plugin-react-hooks` 5.x.

README.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@
77

88
Coding standard used by Shlink JavaScript projects.
99

10-
This library includes two ESLint configurations, the base one, and the react-specific one. Default export includes both:
10+
This library includes two ESLint configurations, the base one (which includes eslint and typescript recommended rules), and the react-specific one (which includes JSX accessibility, react and react hooks recommended rules).
11+
12+
Default export includes both:
1113

1214
```js
1315
// eslint.config.js
1416
import shlink from '@shlinkio/eslint-config-js-coding-standard';
1517

16-
export default shlink;
18+
export default [
19+
...shlink,
20+
{
21+
// Other rules...
22+
}
23+
];
1724
```
1825

1926
If the project does not use React, you can just use the base config:
@@ -22,5 +29,10 @@ If the project does not use React, you can just use the base config:
2229
// eslint.config.js
2330
import { baseConfig } from '@shlinkio/eslint-config-js-coding-standard';
2431

25-
export default baseConfig;
32+
export default [
33+
...baseConfig,
34+
{
35+
// Other rules...
36+
}
37+
];
2638
```

index.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ import simpleImportSort from 'eslint-plugin-simple-import-sort';
77
import tseslint from 'typescript-eslint';
88

99
export const baseConfig = tseslint.config(
10+
eslint.configs.recommended,
11+
...tseslint.configs.recommended,
1012
{
11-
extends: [
12-
eslint.configs.recommended,
13-
...tseslint.configs.recommended,
14-
],
1513
plugins: {
1614
'@stylistic': stylistic,
1715
'simple-import-sort': simpleImportSort,
@@ -73,11 +71,12 @@ export const baseConfig = tseslint.config(
7371
},
7472
);
7573

76-
export const reactConfig = tseslint.config(
74+
export const reactConfig = [
75+
react.configs.flat.recommended,
76+
react.configs.flat['jsx-runtime'],
77+
pluginJsxA11y.flatConfigs.recommended,
7778
{
7879
plugins: {
79-
'jsx-a11y': pluginJsxA11y,
80-
react,
8180
'react-hooks': eslintPluginReactHooks,
8281
},
8382
languageOptions: {
@@ -93,8 +92,8 @@ export const reactConfig = tseslint.config(
9392
}
9493
},
9594
rules: {
96-
...pluginJsxA11y.configs.recommended.rules,
97-
...eslintPluginReactHooks.configs.recommended.rules,
95+
'react-hooks/rules-of-hooks': 'error',
96+
'react-hooks/exhaustive-deps': 'error',
9897

9998
// Disabled rules from presets
10099
'react/display-name': ['off', { 'ignoreTranspilerName': false }],
@@ -107,9 +106,9 @@ export const reactConfig = tseslint.config(
107106
'react/no-children-prop': 'off',
108107
},
109108
},
110-
);
109+
];
111110

112-
export default tseslint.config(
111+
export default [
113112
...baseConfig,
114113
...reactConfig,
115-
);
114+
];

indocker

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
docker compose run shlink_js_coding_standard_node /bin/sh -c "cd /home/shlink && $*"
3+
docker compose run --rm shlink_js_coding_standard_node /bin/sh -c "cd /home/shlink && $*"

0 commit comments

Comments
 (0)