@altafusion/eslint-config 0.0.0-stage → 0.2.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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +27 -2
- package/eslint.config.mjs +4 -0
- package/eslint.ts +137 -0
- package/package.json +43 -3
- package/stylistic.ts +15 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @altafusion/eslint-config
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7767e60: Rebrand for the public release. In `@altafusion/shell`, `CODERMAR_BRANDS`, `CODERMAR_BRAND_THEME` and `utils/codermarBrandTheme` become `ALTAFUSION_*` and `utils/altafusionBrandTheme`, and the brand cookie key is now `altafusion:brand`. In `@altafusion/msw`, the `codermarMsw*` exports become `altafusionMsw*`. The site settings schema `$id` is now `https://altafusion.com/schemas/site-settings.json`. Package descriptions and docs no longer reference private sites.
|
|
8
|
+
|
|
9
|
+
## 0.1.1
|
|
10
|
+
|
|
11
|
+
No changes in this release.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Altafusion
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @altafusion/eslint-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Platform-tier ESLint factories on **`@antfu/eslint-config`** — stylistic defaults stay aligned with **`sharedModuleConfig.eslint`** in **`@altafusion/nuxt-base`** (consumed by **`@nuxt/eslint`**).
|
|
4
|
+
|
|
5
|
+
**Hybrid:** Nuxt apps use **`@nuxt/eslint`** via a layer they directly extend; packages run standalone **`eslint .`** with the factories below.
|
|
6
|
+
|
|
7
|
+
## Factories
|
|
8
|
+
|
|
9
|
+
- **`createPackageEslintConfig`** — TS/JS packages; **`importPathRules`** (deep-relative guard).
|
|
10
|
+
- **`createVuePackageEslintConfig`** — Vue SFC packages + shared Vue block rules.
|
|
11
|
+
- **`createStrictVuePackageEslintConfig`** — stricter prop-type / unused-component checks (Fugue UI layers).
|
|
12
|
+
- **`createNuxtAppEslintConfig`** — Docus-style apps; pair with generated **`.nuxt/eslint.config.mjs`**.
|
|
13
|
+
|
|
14
|
+
Shared exports: **`sharedStylisticDefaults`**, **`sharedVueSfcRules`**, **`strictVueComponentRules`**, **`importPathRules`**.
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { createPackageEslintConfig } from '@altafusion/eslint-config'
|
|
18
|
+
|
|
19
|
+
export default createPackageEslintConfig()
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Consumers
|
|
23
|
+
|
|
24
|
+
> **Local — do not copy-sync.** Repo wiring, ports, catalog keys, consuming apps, and docs-site links.
|
|
25
|
+
|
|
26
|
+
- Consumed by **`@altafusion/nuxt-base`** and every **`packages-platform/*`** / **`packages-fugue/*`** package **`eslint.config.mjs`**.
|
|
27
|
+
- Catalog: **`catalog:dev`** for **`eslint`** / **`@antfu/eslint-config`** (webapp **`catalog:nuxt`** naming differs).
|
|
28
|
+
- Docs: **[Shared packages](../../apps/developer-docs/content/2.monorepo/4.shared-packages.md)** · lint notes in **[Development](../../apps/developer-docs/content/2.monorepo/5.development/)**.
|
package/eslint.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared ESLint configurations for Altafusion packages.
|
|
3
|
+
*
|
|
4
|
+
* **Hybrid preset strategy**
|
|
5
|
+
* - Nuxt apps and templates: `@nuxt/eslint` via the fugue-theme layer — auto-imports, layers, generated config.
|
|
6
|
+
* - Workspace packages: `@antfu/eslint-config` via the factories below — standalone `eslint .` without `nuxt prepare`.
|
|
7
|
+
*
|
|
8
|
+
* Keep stylistic defaults in sync with `sharedModuleConfig.eslint` in `@altafusion/nuxt-base/modules.ts` (consumed by `@nuxt/eslint`).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { Linter } from 'eslint'
|
|
12
|
+
import antfu from '@antfu/eslint-config'
|
|
13
|
+
import { sharedStylisticDefaults } from './stylistic.ts'
|
|
14
|
+
|
|
15
|
+
// Re-exported so the main entry keeps its API; `@altafusion/eslint-config/stylistic` has no lint-toolchain imports.
|
|
16
|
+
export { sharedStylisticDefaults }
|
|
17
|
+
|
|
18
|
+
/** Subset passed to `@antfu/eslint-config` `stylistic` (comma-dangle is enforced via rules, not Antfu `stylistic`). */
|
|
19
|
+
export const antfuStylisticDefaults = {
|
|
20
|
+
braceStyle: sharedStylisticDefaults.braceStyle,
|
|
21
|
+
indent: sharedStylisticDefaults.indent,
|
|
22
|
+
quotes: sharedStylisticDefaults.quotes,
|
|
23
|
+
semi: sharedStylisticDefaults.semi
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const baseAntfuConfig = {
|
|
27
|
+
typescript: true,
|
|
28
|
+
stylistic: antfuStylisticDefaults,
|
|
29
|
+
rules: {
|
|
30
|
+
// Off: antfu/curly requires braces whenever a test is multiline, which conflicts with curly multi-or-nest and breaks --fix.
|
|
31
|
+
'antfu/curly': 'off',
|
|
32
|
+
'curly': ['error', 'multi-or-nest', 'consistent'],
|
|
33
|
+
'no-console': ['warn'],
|
|
34
|
+
'style/comma-dangle': ['error', 'never']
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Shared Vue/SFC rules — script, template, style order + conventions */
|
|
39
|
+
export const sharedVueSfcRules: Record<string, Linter.RuleEntry> = {
|
|
40
|
+
'vue/block-order': [
|
|
41
|
+
'error',
|
|
42
|
+
{
|
|
43
|
+
order: ['script', 'template', 'style']
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
|
|
47
|
+
'vue/prefer-define-options': 'error'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Stricter Vue rules for reusable component packages (fugue-ui, fugue-devtools, …). */
|
|
51
|
+
export const strictVueComponentRules: Record<string, Linter.RuleEntry> = {
|
|
52
|
+
'vue/require-prop-types': 'error',
|
|
53
|
+
'vue/no-unused-components': 'error'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Prefer `@altafusion/*` and `#<scope>/` over relative paths into sibling packages or deep `../` chains. */
|
|
57
|
+
export const importPathRules: Record<string, Linter.RuleEntry> = {
|
|
58
|
+
'ts/no-restricted-imports': [
|
|
59
|
+
'warn',
|
|
60
|
+
{
|
|
61
|
+
patterns: [
|
|
62
|
+
{
|
|
63
|
+
regex: String.raw`^\.\./.*[/](fugue-ui|fugue-storage|fugue-devtools|fugue-theme|nuxt-base|eslint-config|shell|test-kit|msw)(/|$)`,
|
|
64
|
+
message: 'Use @altafusion/* package imports instead of relative paths into sibling packages.'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
regex: String.raw`^\.\./\.\./\.\./`,
|
|
68
|
+
message: 'Prefer #<scope>/ or @altafusion/* imports over three-or-more-level relative paths.'
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function createNuxtAppEslintConfig(overrides: Record<string, unknown> = {}) {
|
|
76
|
+
return antfu({
|
|
77
|
+
...baseAntfuConfig,
|
|
78
|
+
vue: false,
|
|
79
|
+
imports: false,
|
|
80
|
+
rules: {
|
|
81
|
+
...baseAntfuConfig.rules,
|
|
82
|
+
...sharedVueSfcRules,
|
|
83
|
+
...(overrides.rules as object)
|
|
84
|
+
},
|
|
85
|
+
...overrides
|
|
86
|
+
} as unknown as Parameters<typeof antfu>[0]) as unknown as Linter.FlatConfig[]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function createPackageEslintConfig(overrides: Record<string, unknown> = {}) {
|
|
90
|
+
const { ignores: ignoreOverrides, ...restOverrides } = overrides
|
|
91
|
+
const ignores = [
|
|
92
|
+
'**/package.json',
|
|
93
|
+
'**/*.md',
|
|
94
|
+
...(Array.isArray(ignoreOverrides)
|
|
95
|
+
? ignoreOverrides as string[]
|
|
96
|
+
: [])
|
|
97
|
+
]
|
|
98
|
+
return antfu({
|
|
99
|
+
...baseAntfuConfig,
|
|
100
|
+
vue: false,
|
|
101
|
+
imports: true,
|
|
102
|
+
node: true,
|
|
103
|
+
ignores,
|
|
104
|
+
rules: {
|
|
105
|
+
...baseAntfuConfig.rules,
|
|
106
|
+
...importPathRules,
|
|
107
|
+
'ts/no-unused-vars': [
|
|
108
|
+
'error',
|
|
109
|
+
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' }
|
|
110
|
+
],
|
|
111
|
+
...(restOverrides.rules as object)
|
|
112
|
+
},
|
|
113
|
+
...restOverrides
|
|
114
|
+
} as unknown as Parameters<typeof antfu>[0]) as unknown as Linter.FlatConfig[]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function createVuePackageEslintConfig(overrides: Record<string, unknown> = {}): Linter.FlatConfig[] {
|
|
118
|
+
return createPackageEslintConfig({
|
|
119
|
+
...overrides,
|
|
120
|
+
vue: true,
|
|
121
|
+
rules: {
|
|
122
|
+
...sharedVueSfcRules,
|
|
123
|
+
...(overrides.rules as Record<string, unknown>)
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Vue component packages with prop-type and unused-component checks. */
|
|
129
|
+
export function createStrictVuePackageEslintConfig(overrides: Record<string, unknown> = {}): Linter.FlatConfig[] {
|
|
130
|
+
return createVuePackageEslintConfig({
|
|
131
|
+
...overrides,
|
|
132
|
+
rules: {
|
|
133
|
+
...strictVueComponentRules,
|
|
134
|
+
...(overrides.rules as Record<string, unknown>)
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altafusion/eslint-config",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.2.0",
|
|
5
|
+
"description": "Shared ESLint factories and stylistic defaults for Altafusion platform and product packages",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./eslint.ts",
|
|
12
|
+
"./stylistic": "./stylistic.ts"
|
|
13
|
+
},
|
|
14
|
+
"main": "./eslint.ts",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@antfu/eslint-config": "^10.0.0",
|
|
17
|
+
"@types/node": "^26.6.6",
|
|
18
|
+
"eslint": "^10.15.0",
|
|
19
|
+
"typescript": "^6.0.3"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"**",
|
|
23
|
+
"!**/*.test.ts",
|
|
24
|
+
"!**/.nuxt",
|
|
25
|
+
"!**/.output",
|
|
26
|
+
"!**/.data",
|
|
27
|
+
"!**/coverage",
|
|
28
|
+
"!**/node_modules"
|
|
29
|
+
],
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@antfu/eslint-config": "^10.0.0",
|
|
32
|
+
"eslint": "^10.15.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"@antfu/eslint-config": {
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
"eslint": {
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"lint": "eslint .",
|
|
44
|
+
"lint:fix": "eslint . --fix"
|
|
45
|
+
}
|
|
6
46
|
}
|
package/stylistic.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stylistic defaults shared by `@altafusion/nuxt-base` (via `@nuxt/eslint`) and the antfu factories in `./eslint.ts`.
|
|
3
|
+
*
|
|
4
|
+
* Plain data on purpose: no `eslint` or `@antfu/eslint-config` import, so a Nuxt site can build without the lint
|
|
5
|
+
* toolchain installed. Import it as `@altafusion/eslint-config/stylistic`.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Stylistic defaults shared with `@nuxt/eslint` (`sharedModuleConfig.eslint.config.stylistic`). */
|
|
9
|
+
export const sharedStylisticDefaults = {
|
|
10
|
+
commaDangle: 'never' as const,
|
|
11
|
+
braceStyle: '1tbs' as const,
|
|
12
|
+
indent: 2,
|
|
13
|
+
quotes: 'single' as const,
|
|
14
|
+
semi: false
|
|
15
|
+
}
|