@altafusion/eslint-config 0.3.1 → 0.3.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @altafusion/eslint-config
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 46f552d: Ship compiled JavaScript and type declarations. The 0.3.x tarballs exposed raw `.ts` entry points, which Node cannot load from `node_modules` (`ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING`), so `eslint.config.mjs`, Playwright and Vitest configs that import these packages failed outside the workspace. The source stays TypeScript in the repo; `publishConfig` points the packed manifest at `dist/`.
8
+
3
9
  ## 0.3.1
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,45 @@
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
+ import type { Linter } from 'eslint';
11
+ import { sharedStylisticDefaults } from './stylistic.ts';
12
+ export { sharedStylisticDefaults };
13
+ /** Subset passed to `@antfu/eslint-config` `stylistic` (comma-dangle is enforced via rules, not Antfu `stylistic`). */
14
+ export declare const antfuStylisticDefaults: {
15
+ braceStyle: "1tbs";
16
+ indent: number;
17
+ quotes: "single";
18
+ semi: boolean;
19
+ };
20
+ export declare const baseAntfuConfig: {
21
+ typescript: boolean;
22
+ stylistic: {
23
+ braceStyle: "1tbs";
24
+ indent: number;
25
+ quotes: "single";
26
+ semi: boolean;
27
+ };
28
+ rules: {
29
+ 'antfu/curly': string;
30
+ curly: string[];
31
+ 'no-console': string[];
32
+ 'style/comma-dangle': string[];
33
+ };
34
+ };
35
+ /** Shared Vue/SFC rules — script, template, style order + conventions */
36
+ export declare const sharedVueSfcRules: Record<string, Linter.RuleEntry>;
37
+ /** Stricter Vue rules for reusable component packages (fugue-ui, fugue-devtools, …). */
38
+ export declare const strictVueComponentRules: Record<string, Linter.RuleEntry>;
39
+ /** Prefer `@altafusion/*` and `#<scope>/` over relative paths into sibling packages or deep `../` chains. */
40
+ export declare const importPathRules: Record<string, Linter.RuleEntry>;
41
+ export declare function createNuxtAppEslintConfig(overrides?: Record<string, unknown>): Linter.FlatConfig[];
42
+ export declare function createPackageEslintConfig(overrides?: Record<string, unknown>): Linter.FlatConfig[];
43
+ export declare function createVuePackageEslintConfig(overrides?: Record<string, unknown>): Linter.FlatConfig[];
44
+ /** Vue component packages with prop-type and unused-component checks. */
45
+ export declare function createStrictVuePackageEslintConfig(overrides?: Record<string, unknown>): Linter.FlatConfig[];
package/dist/eslint.js ADDED
@@ -0,0 +1,125 @@
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
+ import antfu from '@antfu/eslint-config';
11
+ import { sharedStylisticDefaults } from "./stylistic.js";
12
+ // Re-exported so the main entry keeps its API; `@altafusion/eslint-config/stylistic` has no lint-toolchain imports.
13
+ export { sharedStylisticDefaults };
14
+ /** Subset passed to `@antfu/eslint-config` `stylistic` (comma-dangle is enforced via rules, not Antfu `stylistic`). */
15
+ export const antfuStylisticDefaults = {
16
+ braceStyle: sharedStylisticDefaults.braceStyle,
17
+ indent: sharedStylisticDefaults.indent,
18
+ quotes: sharedStylisticDefaults.quotes,
19
+ semi: sharedStylisticDefaults.semi
20
+ };
21
+ export const baseAntfuConfig = {
22
+ typescript: true,
23
+ stylistic: antfuStylisticDefaults,
24
+ rules: {
25
+ // Off: antfu/curly requires braces whenever a test is multiline, which conflicts with curly multi-or-nest and breaks --fix.
26
+ 'antfu/curly': 'off',
27
+ 'curly': ['error', 'multi-or-nest', 'consistent'],
28
+ 'no-console': ['warn'],
29
+ 'style/comma-dangle': ['error', 'never']
30
+ }
31
+ };
32
+ /** Shared Vue/SFC rules — script, template, style order + conventions */
33
+ export const sharedVueSfcRules = {
34
+ 'vue/block-order': [
35
+ 'error',
36
+ {
37
+ order: ['script', 'template', 'style']
38
+ }
39
+ ],
40
+ 'vue/component-name-in-template-casing': ['error', 'PascalCase'],
41
+ 'vue/prefer-define-options': 'error'
42
+ };
43
+ /** Stricter Vue rules for reusable component packages (fugue-ui, fugue-devtools, …). */
44
+ export const strictVueComponentRules = {
45
+ 'vue/require-prop-types': 'error',
46
+ 'vue/no-unused-components': 'error'
47
+ };
48
+ /** Prefer `@altafusion/*` and `#<scope>/` over relative paths into sibling packages or deep `../` chains. */
49
+ export const importPathRules = {
50
+ 'ts/no-restricted-imports': [
51
+ 'warn',
52
+ {
53
+ patterns: [
54
+ {
55
+ regex: String.raw `^\.\./.*[/](fugue-ui|fugue-storage|fugue-devtools|fugue-theme|nuxt-base|eslint-config|shell|test-kit|msw)(/|$)`,
56
+ message: 'Use @altafusion/* package imports instead of relative paths into sibling packages.'
57
+ },
58
+ {
59
+ regex: String.raw `^\.\./\.\./\.\./`,
60
+ message: 'Prefer #<scope>/ or @altafusion/* imports over three-or-more-level relative paths.'
61
+ }
62
+ ]
63
+ }
64
+ ]
65
+ };
66
+ export function createNuxtAppEslintConfig(overrides = {}) {
67
+ return antfu({
68
+ ...baseAntfuConfig,
69
+ vue: false,
70
+ imports: false,
71
+ rules: {
72
+ ...baseAntfuConfig.rules,
73
+ ...sharedVueSfcRules,
74
+ ...overrides.rules
75
+ },
76
+ ...overrides
77
+ });
78
+ }
79
+ export function createPackageEslintConfig(overrides = {}) {
80
+ const { ignores: ignoreOverrides, ...restOverrides } = overrides;
81
+ const ignores = [
82
+ '**/package.json',
83
+ '**/*.md',
84
+ ...(Array.isArray(ignoreOverrides)
85
+ ? ignoreOverrides
86
+ : [])
87
+ ];
88
+ return antfu({
89
+ ...baseAntfuConfig,
90
+ vue: false,
91
+ imports: true,
92
+ node: true,
93
+ ignores,
94
+ rules: {
95
+ ...baseAntfuConfig.rules,
96
+ ...importPathRules,
97
+ 'ts/no-unused-vars': [
98
+ 'error',
99
+ { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }
100
+ ],
101
+ ...restOverrides.rules
102
+ },
103
+ ...restOverrides
104
+ });
105
+ }
106
+ export function createVuePackageEslintConfig(overrides = {}) {
107
+ return createPackageEslintConfig({
108
+ ...overrides,
109
+ vue: true,
110
+ rules: {
111
+ ...sharedVueSfcRules,
112
+ ...overrides.rules
113
+ }
114
+ });
115
+ }
116
+ /** Vue component packages with prop-type and unused-component checks. */
117
+ export function createStrictVuePackageEslintConfig(overrides = {}) {
118
+ return createVuePackageEslintConfig({
119
+ ...overrides,
120
+ rules: {
121
+ ...strictVueComponentRules,
122
+ ...overrides.rules
123
+ }
124
+ });
125
+ }
@@ -0,0 +1,14 @@
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
+ /** Stylistic defaults shared with `@nuxt/eslint` (`sharedModuleConfig.eslint.config.stylistic`). */
8
+ export declare const sharedStylisticDefaults: {
9
+ commaDangle: "never";
10
+ braceStyle: "1tbs";
11
+ indent: number;
12
+ quotes: "single";
13
+ semi: boolean;
14
+ };
@@ -4,12 +4,11 @@
4
4
  * Plain data on purpose: no `eslint` or `@antfu/eslint-config` import, so a Nuxt site can build without the lint
5
5
  * toolchain installed. Import it as `@altafusion/eslint-config/stylistic`.
6
6
  */
7
-
8
7
  /** Stylistic defaults shared with `@nuxt/eslint` (`sharedModuleConfig.eslint.config.stylistic`). */
9
8
  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
- }
9
+ commaDangle: 'never',
10
+ braceStyle: '1tbs',
11
+ indent: 2,
12
+ quotes: 'single',
13
+ semi: false
14
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@altafusion/eslint-config",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "description": "Shared ESLint factories and stylistic defaults for Altafusion platform and product packages",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/altafusion/fugue/tree/main/packages-platform/eslint-config#readme",
@@ -17,10 +17,16 @@
17
17
  "access": "public"
18
18
  },
19
19
  "exports": {
20
- ".": "./eslint.ts",
21
- "./stylistic": "./stylistic.ts"
20
+ ".": {
21
+ "types": "./dist/eslint.d.ts",
22
+ "default": "./dist/eslint.js"
23
+ },
24
+ "./stylistic": {
25
+ "types": "./dist/stylistic.d.ts",
26
+ "default": "./dist/stylistic.js"
27
+ }
22
28
  },
23
- "main": "./eslint.ts",
29
+ "main": "./dist/eslint.js",
24
30
  "devDependencies": {
25
31
  "@antfu/eslint-config": "^10.0.0",
26
32
  "@types/node": "^26.6.6",
@@ -28,13 +34,10 @@
28
34
  "typescript": "^6.0.3"
29
35
  },
30
36
  "files": [
31
- "**",
32
- "!**/*.test.ts",
33
- "!**/.nuxt",
34
- "!**/.output",
35
- "!**/.data",
36
- "!**/coverage",
37
- "!**/node_modules"
37
+ "dist",
38
+ "README.md",
39
+ "LICENSE",
40
+ "CHANGELOG.md"
38
41
  ],
39
42
  "peerDependencies": {
40
43
  "@antfu/eslint-config": "^10.0.0",
@@ -50,6 +53,8 @@
50
53
  },
51
54
  "scripts": {
52
55
  "lint": "eslint .",
53
- "lint:fix": "eslint . --fix"
54
- }
56
+ "lint:fix": "eslint . --fix",
57
+ "build": "tsc -p tsconfig.build.json"
58
+ },
59
+ "types": "./dist/eslint.d.ts"
55
60
  }
package/eslint.config.mjs DELETED
@@ -1,4 +0,0 @@
1
- // @ts-check
2
- import { createPackageEslintConfig } from '@altafusion/eslint-config'
3
-
4
- export default createPackageEslintConfig()
package/eslint.ts DELETED
@@ -1,137 +0,0 @@
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
- }