Skip to content

Commit 278b4da

Browse files
authored
Implement global ignores
Server updates: -ESLint config now exported as an array to support global ignores UI updates: - ESLint config now exported as an array to support global ignores - Added new React rule: react/jsx-curly-brace-presence with props: "never", children: "never"
1 parent f139569 commit 278b4da

11 files changed

Lines changed: 236 additions & 120 deletions

File tree

packages/server/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [2.0.0] - 2026-03-30
7+
8+
### Changed
9+
- ESLint config now exported as an array to support global `ignores`
10+
11+
[2.0.0]: https://github.com/hystax/eslint-config-hystax/tree/packages/server/v2.0.0
12+
13+
614
## [1.0.0] - 2026-02-20
715

816
### Added
917
- Initial release of `@hystax/eslint-config-server`
1018
- Includes base ESLint rules for Server projects (Node.js, TypeScript, Prettier, etc.)
1119

12-
[1.0.0]: https://github.com/hystax/eslint-config-hystax/tree/20260220-01/packages/server
20+
[1.0.0]: https://github.com/hystax/eslint-config-hystax/tree/packages/server/v1.0.0

packages/server/README.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,48 @@ npm install -D @hystax/eslint-config-server
2020
In your project’s _eslint.config.mjs_, import and use the shared configuration.
2121

2222
Basic example (Server project)
23+
2324
```javascript
2425
import config from "@hystax/eslint-config-server";
26+
27+
// The config is an array; the first element contains global ignore
2528
export default config;
2629
```
2730

28-
You can also use an array form if you plan to combine multiple configs:
31+
### 🧩 Combining with other configs or local overrides
2932

3033
```javascript
3134
import config from "@hystax/eslint-config-server";
32-
export default [config];
35+
export default [
36+
...config,
37+
{
38+
// Add or override rules here
39+
rules: {
40+
"no-console": "warn",
41+
"import/order": [
42+
"error",
43+
{ groups: ["builtin", "external", "internal"] },
44+
],
45+
},
46+
},
47+
];
3348
```
3449

35-
### 🧩 Override file globs or rules
50+
### 🧩 Add or override global ignores
51+
3652
```javascript
3753
import config from "@hystax/eslint-config-server";
54+
55+
const globalIgnores = config[0];
56+
const configRules = config.slice(1);
57+
3858
export default [
3959
{
40-
...config,
41-
files: ["src/**/*.{ts}"],
42-
rules: {
43-
...config.rules,
44-
"no-console": "warn"
45-
}
46-
}
60+
// Extend existing global ignores or override them
61+
...globalIgnores,
62+
ignores: [...(globalIgnores.ignores || []), "./dist"],
63+
},
64+
...configRules,
4765
];
4866
```
4967

@@ -55,6 +73,8 @@ export default [
5573

5674
- Designed for consistency across all Hystax frontend projects.
5775

76+
- The first element of the exported array contains global ignores, so it’s important to spread the array if adding additional rules.
77+
5878
## 📄 License
5979

60-
[Apache License Version 2.0](https://choosealicense.com/licenses/apache-2.0/)
80+
[Apache License Version 2.0](https://choosealicense.com/licenses/apache-2.0/)

packages/server/index.mjs

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,63 @@ import nodeRules from "./rules/node.mjs";
1111
import importsRules from "./rules/imports.mjs";
1212
import prettierRules from "./rules/prettier.mjs";
1313

14-
export default {
15-
ignores: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.next/**"],
16-
17-
files: ["**/*.ts"],
18-
19-
plugins: {
20-
node: nodePlugin,
21-
import: eslintPluginImport,
22-
"unused-imports": unusedImportsPlugin,
23-
"@typescript-eslint": typescriptPlugin,
24-
prettier: eslintPluginPrettier,
14+
export default [
15+
{
16+
ignores: [
17+
"**/node_modules/**",
18+
"**/dist/**",
19+
"**/build/**",
20+
"**/.next/**",
21+
"**/.out/**",
22+
"**/.turbo/**",
23+
"**/.cache/**",
24+
"**/.parcel-cache/**",
25+
"**/.vite/**",
26+
"**/coverage/**",
27+
"**/tmp/**",
28+
"**/temp/**",
29+
],
2530
},
31+
{
32+
files: ["**/*.ts"],
2633

27-
languageOptions: {
28-
parser: typescriptParser,
29-
parserOptions: {
30-
ecmaVersion: "latest",
31-
sourceType: "module",
34+
plugins: {
35+
node: nodePlugin,
36+
import: eslintPluginImport,
37+
"unused-imports": unusedImportsPlugin,
38+
"@typescript-eslint": typescriptPlugin,
39+
prettier: eslintPluginPrettier,
3240
},
33-
globals: {
34-
...globals.node,
35-
...globals.builtin,
36-
...globals.jest,
37-
vi: true,
41+
42+
languageOptions: {
43+
parser: typescriptParser,
44+
parserOptions: {
45+
ecmaVersion: "latest",
46+
sourceType: "module",
47+
},
48+
globals: {
49+
...globals.node,
50+
...globals.builtin,
51+
...globals.jest,
52+
vi: true,
53+
},
3854
},
39-
},
4055

41-
settings: {
42-
"import/resolver": {
43-
node: {
44-
extensions: [".js", ".cjs", ".mjs", ".ts"],
45-
moduleDirectory: ["node_modules", "src/"],
56+
settings: {
57+
"import/resolver": {
58+
node: {
59+
extensions: [".js", ".cjs", ".mjs", ".ts"],
60+
moduleDirectory: ["node_modules", "src/"],
61+
},
4662
},
63+
"import/ignore": ["node_modules"],
4764
},
48-
"import/ignore": ["node_modules"],
49-
},
5065

51-
rules: {
52-
...baseRules,
53-
...nodeRules,
54-
...importsRules,
55-
...prettierRules,
66+
rules: {
67+
...baseRules,
68+
...nodeRules,
69+
...importsRules,
70+
...prettierRules,
71+
},
5672
},
57-
};
73+
];

packages/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hystax/eslint-config-server",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "Server ESLint config for Hystax projects",
55
"main": "index.mjs",
66
"type": "module",

packages/server/test.mjs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,34 @@ const files = [
1919

2020
if (file === "./index.mjs") {
2121
const config = module.default;
22-
if (!config || typeof config !== "object") {
23-
throw new Error("config export is missing or not an object");
22+
if (!Array.isArray(config)) {
23+
throw new Error(
24+
"index.mjs export should be an array (config array is missing or invalid)"
25+
);
2426
}
25-
if (!config.rules || typeof config.rules !== "object") {
26-
throw new Error("config.rules is missing or invalid");
27+
28+
for (const [i, item] of config.entries()) {
29+
if (!item || typeof item !== "object") {
30+
throw new Error(
31+
`index.mjs array element at position ${i} is not an object`
32+
);
33+
}
34+
}
35+
36+
const hasRules = config.some(
37+
(item) => item.rules && typeof item.rules === "object"
38+
);
39+
if (!hasRules) {
40+
throw new Error(
41+
"index.mjs array must contain at least one object with rules"
42+
);
2743
}
2844
}
2945
})
3046
);
3147

3248
console.log(
33-
"✅ All ESLint config files loaded successfully and are valid objects."
49+
"✅ All ESLint config files loaded successfully and are valid."
3450
);
3551
} catch (err) {
3652
console.error("❌ Failed to load config:", err);

packages/ui/CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [2.0.0] - 2026-03-30
7+
8+
### Changed
9+
- ESLint config now exported as an array to support global `ignores`
10+
- Added new React rule: `react/jsx-curly-brace-presence` with `props: "never", children: "never"`
11+
12+
[2.0.0]: https://github.com/hystax/eslint-config-hystax/tree/packages/ui/v2.0.0
13+
14+
615
## [1.0.0] - 2025-11-03
716

817
### Added
918
- Initial release of `@hystax/eslint-config-ui`
1019
- Includes base ESLint rules for UI projects (React, JSX, TypeScript, Prettier, etc.)
1120

12-
[1.0.0]: https://github.com/hystax/eslint-config-hystax/tree/20251103-01/packages/ui
21+
[1.0.0]: https://github.com/hystax/eslint-config-hystax/tree/packages/ui/v1.0.0

packages/ui/README.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,48 @@ npm install -D @hystax/eslint-config-ui
2020
In your project’s _eslint.config.mjs_, import and use the shared configuration.
2121

2222
Basic example (UI project)
23+
2324
```javascript
2425
import config from "@hystax/eslint-config-ui";
26+
27+
// The config is an array; the first element contains global ignore
2528
export default config;
2629
```
2730

28-
You can also use an array form if you plan to combine multiple configs:
31+
### 🧩 Combining with other configs or local overrides
2932

3033
```javascript
3134
import config from "@hystax/eslint-config-ui";
32-
export default [config];
35+
export default [
36+
...config,
37+
{
38+
// Add or override rules here
39+
rules: {
40+
"no-console": "warn",
41+
"import/order": [
42+
"error",
43+
{ groups: ["builtin", "external", "internal"] },
44+
],
45+
},
46+
},
47+
];
3348
```
3449

35-
### 🧩 Override file globs or rules
50+
### 🧩 Add or override global ignores
51+
3652
```javascript
3753
import config from "@hystax/eslint-config-ui";
54+
55+
const globalIgnores = config[0];
56+
const configRules = config.slice(1);
57+
3858
export default [
3959
{
40-
...config,
41-
files: ["src/**/*.{ts,tsx}"],
42-
rules: {
43-
...config.rules,
44-
"no-console": "warn"
45-
}
46-
}
60+
// Extend existing global ignores or override them
61+
...globalIgnores,
62+
ignores: [...(globalIgnores.ignores || []), "./dist"],
63+
},
64+
...configRules,
4765
];
4866
```
4967

@@ -55,6 +73,8 @@ export default [
5573

5674
- Designed for consistency across all Hystax frontend projects.
5775

76+
- The first element of the exported array contains global ignores, so it’s important to spread the array if adding additional rules.
77+
5878
## 📄 License
5979

60-
[Apache License Version 2.0](https://choosealicense.com/licenses/apache-2.0/)
80+
[Apache License Version 2.0](https://choosealicense.com/licenses/apache-2.0/)

0 commit comments

Comments
 (0)