@diia-inhouse/oxc-config 5.0.2 → 6.0.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../oxlint/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAsC,MAAM,QAAQ,CAAA;AAE9E,KAAK,MAAM,GAAG,YAAY,GAAG;IAAE,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../oxlint/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAsC,MAAM,QAAQ,CAAA;AAE9E,KAAK,MAAM,GAAG,YAAY,GAAG;IAAE,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AAujBzD,eAAO,MAAM,IAAI,EAAE,MAAuC,CAAA;AAE1D,eAAO,MAAM,UAAU,EAAE,MAKvB,CAAA;AAIF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,KAAG,YAOnD,CAAA"}
|
package/dist/oxlint/config.js
CHANGED
|
@@ -69,6 +69,7 @@ const baseConfig = {
|
|
|
69
69
|
'import/prefer-default-export': 'off',
|
|
70
70
|
'import/named': 'off',
|
|
71
71
|
'import/namespace': 'off',
|
|
72
|
+
'import/no-cycle': ['error', { ignoreTypes: true }],
|
|
72
73
|
'import/no-unassigned-import': ['warn', { allow: ['**/*.css', 'reflect-metadata', 'module-alias/register'] }],
|
|
73
74
|
'typescript/consistent-type-assertions': ['error', { assertionStyle: 'as' }],
|
|
74
75
|
'typescript/no-unsafe-type-assertion': 'off',
|
|
@@ -5,7 +5,7 @@ import { dirname, join, relative, resolve } from 'node:path'
|
|
|
5
5
|
const FIX_FLAGS = new Set(['--fix', '--fix-suggestions', '--fix-dangerously'])
|
|
6
6
|
const DEPENDENCY_FIELDS = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']
|
|
7
7
|
const PUBLISH_FIELDS = ['license', 'files', 'publishConfig', 'repository']
|
|
8
|
-
const LEGACY_CONFIG_FIELDS = ['prettier', 'eslintConfig', 'eslintIgnore']
|
|
8
|
+
const LEGACY_CONFIG_FIELDS = ['prettier', 'eslintConfig', 'eslintIgnore', 'madge']
|
|
9
9
|
const LEGACY_PACKAGES = [
|
|
10
10
|
'eslint',
|
|
11
11
|
'typescript-eslint',
|
|
@@ -20,9 +20,14 @@ const LEGACY_PACKAGES = [
|
|
|
20
20
|
'ts-node',
|
|
21
21
|
'ts-node-dev',
|
|
22
22
|
'nodemon',
|
|
23
|
+
'madge',
|
|
23
24
|
]
|
|
24
|
-
const
|
|
25
|
-
|
|
25
|
+
const LEGACY_SCRIPTS = new Map([
|
|
26
|
+
['eslint', 'eslint'],
|
|
27
|
+
['prettier', 'prettier'],
|
|
28
|
+
['find-circulars', 'madge'],
|
|
29
|
+
])
|
|
30
|
+
const LEGACY_TOOL_PATTERN = /\b(eslint|prettier|madge)\b/
|
|
26
31
|
const SERVICE_NAME_PATTERN = /^service-|-service$/
|
|
27
32
|
const VERSION_RANGE_PATTERN = /^[\^~]/
|
|
28
33
|
const EXACT_VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/
|
|
@@ -50,7 +55,6 @@ const DEV_TOOL_PATTERNS = [
|
|
|
50
55
|
/^@eslint\//,
|
|
51
56
|
/^prettier(-|$)/,
|
|
52
57
|
/^typescript$/,
|
|
53
|
-
/^madge$/,
|
|
54
58
|
/^lockfile-lint$/,
|
|
55
59
|
/^semantic-release(-|$)/,
|
|
56
60
|
/^@semantic-release\//,
|
|
@@ -64,7 +68,6 @@ const DEFAULT_NODE_MAJOR = 24
|
|
|
64
68
|
const DEFAULT_AUTHOR = 'diia-team'
|
|
65
69
|
const DEV_SCRIPT = 'diia-dev'
|
|
66
70
|
const COMMITLINT_CONFIG = '@diia-inhouse/configs/dist/commitlint'
|
|
67
|
-
const MADGE_TS_CONFIG = './tsconfig.json'
|
|
68
71
|
const RUNTIME_SOURCE_PATTERN = /^src\//
|
|
69
72
|
const TEST_SOURCE_PATTERN = /(^|\/)(tests?|__tests__|__mocks__)\/|\.(spec|test)\.[cm]?[jt]sx?$/
|
|
70
73
|
const RUNTIME_DEPENDENCY_FIELDS = ['dependencies', 'peerDependencies', 'optionalDependencies']
|
|
@@ -408,7 +411,7 @@ export const manifestRules = {
|
|
|
408
411
|
const violations = []
|
|
409
412
|
|
|
410
413
|
for (const [name, body] of Object.entries(scripts)) {
|
|
411
|
-
const tool =
|
|
414
|
+
const tool = LEGACY_SCRIPTS.get(name) ?? LEGACY_TOOL_PATTERN.exec(String(body))?.[1]
|
|
412
415
|
|
|
413
416
|
if (tool) {
|
|
414
417
|
violations.push({ messageId: 'script', data: { name, tool } })
|
|
@@ -419,7 +422,7 @@ export const manifestRules = {
|
|
|
419
422
|
},
|
|
420
423
|
fix: (data) => {
|
|
421
424
|
for (const [name, body] of Object.entries(data.scripts ?? {})) {
|
|
422
|
-
if (
|
|
425
|
+
if (LEGACY_SCRIPTS.has(name)) {
|
|
423
426
|
delete data.scripts[name]
|
|
424
427
|
} else {
|
|
425
428
|
data.scripts[name] = String(body)
|
|
@@ -558,7 +561,6 @@ export const manifestRules = {
|
|
|
558
561
|
'shared-configs': {
|
|
559
562
|
messages: {
|
|
560
563
|
commitlint: 'package.json "commitlint.extends" must be "{{ expected }}" so commit messages are checked by the shared rules.',
|
|
561
|
-
madge: 'package.json "madge.tsConfig" must be "{{ expected }}" so find-circulars resolves the same paths as the build.',
|
|
562
564
|
},
|
|
563
565
|
check: (data) => {
|
|
564
566
|
const violations = []
|
|
@@ -567,10 +569,6 @@ export const manifestRules = {
|
|
|
567
569
|
violations.push({ messageId: 'commitlint', data: { expected: COMMITLINT_CONFIG } })
|
|
568
570
|
}
|
|
569
571
|
|
|
570
|
-
if (dependsOn(data, 'madge') && data.madge?.tsConfig !== MADGE_TS_CONFIG) {
|
|
571
|
-
violations.push({ messageId: 'madge', data: { expected: MADGE_TS_CONFIG } })
|
|
572
|
-
}
|
|
573
|
-
|
|
574
572
|
return violations
|
|
575
573
|
},
|
|
576
574
|
fix: (data) => {
|
|
@@ -578,10 +576,6 @@ export const manifestRules = {
|
|
|
578
576
|
data.commitlint = { ...data.commitlint, extends: COMMITLINT_CONFIG }
|
|
579
577
|
}
|
|
580
578
|
|
|
581
|
-
if (dependsOn(data, 'madge')) {
|
|
582
|
-
data.madge = { ...data.madge, tsConfig: MADGE_TS_CONFIG }
|
|
583
|
-
}
|
|
584
|
-
|
|
585
579
|
return data
|
|
586
580
|
},
|
|
587
581
|
},
|
|
@@ -5,7 +5,7 @@ import { dirname, join, relative, resolve } from 'node:path'
|
|
|
5
5
|
const FIX_FLAGS = new Set(['--fix', '--fix-suggestions', '--fix-dangerously'])
|
|
6
6
|
const DEPENDENCY_FIELDS = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']
|
|
7
7
|
const PUBLISH_FIELDS = ['license', 'files', 'publishConfig', 'repository']
|
|
8
|
-
const LEGACY_CONFIG_FIELDS = ['prettier', 'eslintConfig', 'eslintIgnore']
|
|
8
|
+
const LEGACY_CONFIG_FIELDS = ['prettier', 'eslintConfig', 'eslintIgnore', 'madge']
|
|
9
9
|
const LEGACY_PACKAGES = [
|
|
10
10
|
'eslint',
|
|
11
11
|
'typescript-eslint',
|
|
@@ -20,9 +20,14 @@ const LEGACY_PACKAGES = [
|
|
|
20
20
|
'ts-node',
|
|
21
21
|
'ts-node-dev',
|
|
22
22
|
'nodemon',
|
|
23
|
+
'madge',
|
|
23
24
|
]
|
|
24
|
-
const
|
|
25
|
-
|
|
25
|
+
const LEGACY_SCRIPTS = new Map([
|
|
26
|
+
['eslint', 'eslint'],
|
|
27
|
+
['prettier', 'prettier'],
|
|
28
|
+
['find-circulars', 'madge'],
|
|
29
|
+
])
|
|
30
|
+
const LEGACY_TOOL_PATTERN = /\b(eslint|prettier|madge)\b/
|
|
26
31
|
const SERVICE_NAME_PATTERN = /^service-|-service$/
|
|
27
32
|
const VERSION_RANGE_PATTERN = /^[\^~]/
|
|
28
33
|
const EXACT_VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/
|
|
@@ -50,7 +55,6 @@ const DEV_TOOL_PATTERNS = [
|
|
|
50
55
|
/^@eslint\//,
|
|
51
56
|
/^prettier(-|$)/,
|
|
52
57
|
/^typescript$/,
|
|
53
|
-
/^madge$/,
|
|
54
58
|
/^lockfile-lint$/,
|
|
55
59
|
/^semantic-release(-|$)/,
|
|
56
60
|
/^@semantic-release\//,
|
|
@@ -64,7 +68,6 @@ const DEFAULT_NODE_MAJOR = 24
|
|
|
64
68
|
const DEFAULT_AUTHOR = 'diia-team'
|
|
65
69
|
const DEV_SCRIPT = 'diia-dev'
|
|
66
70
|
const COMMITLINT_CONFIG = '@diia-inhouse/configs/dist/commitlint'
|
|
67
|
-
const MADGE_TS_CONFIG = './tsconfig.json'
|
|
68
71
|
const RUNTIME_SOURCE_PATTERN = /^src\//
|
|
69
72
|
const TEST_SOURCE_PATTERN = /(^|\/)(tests?|__tests__|__mocks__)\/|\.(spec|test)\.[cm]?[jt]sx?$/
|
|
70
73
|
const RUNTIME_DEPENDENCY_FIELDS = ['dependencies', 'peerDependencies', 'optionalDependencies']
|
|
@@ -408,7 +411,7 @@ export const manifestRules = {
|
|
|
408
411
|
const violations = []
|
|
409
412
|
|
|
410
413
|
for (const [name, body] of Object.entries(scripts)) {
|
|
411
|
-
const tool =
|
|
414
|
+
const tool = LEGACY_SCRIPTS.get(name) ?? LEGACY_TOOL_PATTERN.exec(String(body))?.[1]
|
|
412
415
|
|
|
413
416
|
if (tool) {
|
|
414
417
|
violations.push({ messageId: 'script', data: { name, tool } })
|
|
@@ -419,7 +422,7 @@ export const manifestRules = {
|
|
|
419
422
|
},
|
|
420
423
|
fix: (data) => {
|
|
421
424
|
for (const [name, body] of Object.entries(data.scripts ?? {})) {
|
|
422
|
-
if (
|
|
425
|
+
if (LEGACY_SCRIPTS.has(name)) {
|
|
423
426
|
delete data.scripts[name]
|
|
424
427
|
} else {
|
|
425
428
|
data.scripts[name] = String(body)
|
|
@@ -558,7 +561,6 @@ export const manifestRules = {
|
|
|
558
561
|
'shared-configs': {
|
|
559
562
|
messages: {
|
|
560
563
|
commitlint: 'package.json "commitlint.extends" must be "{{ expected }}" so commit messages are checked by the shared rules.',
|
|
561
|
-
madge: 'package.json "madge.tsConfig" must be "{{ expected }}" so find-circulars resolves the same paths as the build.',
|
|
562
564
|
},
|
|
563
565
|
check: (data) => {
|
|
564
566
|
const violations = []
|
|
@@ -567,10 +569,6 @@ export const manifestRules = {
|
|
|
567
569
|
violations.push({ messageId: 'commitlint', data: { expected: COMMITLINT_CONFIG } })
|
|
568
570
|
}
|
|
569
571
|
|
|
570
|
-
if (dependsOn(data, 'madge') && data.madge?.tsConfig !== MADGE_TS_CONFIG) {
|
|
571
|
-
violations.push({ messageId: 'madge', data: { expected: MADGE_TS_CONFIG } })
|
|
572
|
-
}
|
|
573
|
-
|
|
574
572
|
return violations
|
|
575
573
|
},
|
|
576
574
|
fix: (data) => {
|
|
@@ -578,10 +576,6 @@ export const manifestRules = {
|
|
|
578
576
|
data.commitlint = { ...data.commitlint, extends: COMMITLINT_CONFIG }
|
|
579
577
|
}
|
|
580
578
|
|
|
581
|
-
if (dependsOn(data, 'madge')) {
|
|
582
|
-
data.madge = { ...data.madge, tsConfig: MADGE_TS_CONFIG }
|
|
583
|
-
}
|
|
584
|
-
|
|
585
579
|
return data
|
|
586
580
|
},
|
|
587
581
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diia-inhouse/oxc-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "OXC toolchain configs for Diia services: oxlint, oxfmt, oxc transformer",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "diia-team",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"prepare": "npm run build",
|
|
26
26
|
"lint": "oxlint && oxfmt --check",
|
|
27
27
|
"lint-fix": "oxlint --fix && oxfmt",
|
|
28
|
-
"find-circulars": "madge --circular --extensions ts ./",
|
|
29
28
|
"lint:lockfile": "lockfile-lint --path package-lock.json --allowed-hosts registry.npmjs.org --validate-https",
|
|
30
29
|
"semantic-release": "semantic-release"
|
|
31
30
|
},
|
|
@@ -45,7 +44,6 @@
|
|
|
45
44
|
"@vitest/coverage-v8": "5.0.5",
|
|
46
45
|
"@vitest/ui": "5.0.5",
|
|
47
46
|
"lockfile-lint": "5.0.1",
|
|
48
|
-
"madge": "8.0.0",
|
|
49
47
|
"oxfmt": "0.72.0",
|
|
50
48
|
"oxlint": "1.87.0",
|
|
51
49
|
"oxlint-tsgolint": "7.0.2003",
|
|
@@ -68,8 +66,5 @@
|
|
|
68
66
|
},
|
|
69
67
|
"engines": {
|
|
70
68
|
"node": ">=24"
|
|
71
|
-
},
|
|
72
|
-
"madge": {
|
|
73
|
-
"tsConfig": "./tsconfig.json"
|
|
74
69
|
}
|
|
75
70
|
}
|