@accordproject/concerto-linter 3.25.7 → 4.0.0-beta.1
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/default-ruleset/package.json +8 -8
- package/default-ruleset/test/rules/namespace-version.test.ts +0 -9
- package/default-ruleset/tsconfig.json +1 -1
- package/dist/config-loader.js +12 -25
- package/dist/config-loader.js.map +1 -1
- package/dist/index.js +24 -38
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
- package/src/config-loader.ts +1 -1
- package/src/index.ts +1 -1
- package/test/unit/lintModel.test.ts +3 -3
- package/tsconfig.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@accordproject/concerto-linter-default-ruleset",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.1",
|
|
4
4
|
"description": "Default ruleset for the Accord Project Concerto Linter",
|
|
5
5
|
"homepage": "https://github.com/accordproject/concerto",
|
|
6
6
|
"engines": {
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"author": "accordproject.org",
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@accordproject/concerto-
|
|
36
|
+
"@accordproject/concerto-core": "4.0.0-beta.1",
|
|
37
37
|
"@stoplight/spectral-core": "1.20.0",
|
|
38
38
|
"@stoplight/spectral-functions": "1.10.1",
|
|
39
39
|
"@stoplight/spectral-parsers": "1.0.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"eslint": "8.57.1",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
44
|
-
"@typescript-eslint/parser": "8.
|
|
45
|
-
"npm-run-all": "4.1.5",
|
|
46
|
-
"rimraf": "6.0.1",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
44
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
45
|
+
"npm-run-all": "^4.1.5",
|
|
46
|
+
"rimraf": "^6.0.1",
|
|
47
47
|
"typescript": "5.7.2",
|
|
48
|
-
"jest": "29.7.0",
|
|
49
|
-
"ts-jest": "29.2.5"
|
|
48
|
+
"jest": "^29.7.0",
|
|
49
|
+
"ts-jest": "^29.2.5"
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -21,13 +21,4 @@ describe('Namespace Version Rule', () => {
|
|
|
21
21
|
expect(results[0].code).toBe('namespace-version');
|
|
22
22
|
expect(results[0].message).toContain('should specify a version');
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
test('should not report violations when imports use wildcard semver selectors', async () => {
|
|
26
|
-
const results = await testRules({
|
|
27
|
-
rules: {
|
|
28
|
-
'namespace-version': namespaceVersion,
|
|
29
|
-
},
|
|
30
|
-
}, 'namespace-wildcard-imports.cto');
|
|
31
|
-
expect(results).toHaveLength(0);
|
|
32
|
-
});
|
|
33
24
|
});
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
12
|
|
|
13
13
|
/* Language and Environment */
|
|
14
|
-
"target": "
|
|
14
|
+
"target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
15
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
16
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
17
|
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
package/dist/config-loader.js
CHANGED
|
@@ -12,15 +12,6 @@
|
|
|
12
12
|
* See the License for the specific language governing permissions and
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
15
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
16
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
17
|
};
|
|
@@ -38,28 +29,24 @@ const SPECTRAL_RULESET_FILES = [
|
|
|
38
29
|
* Searches for a Spectral ruleset configuration file in the current and parent directories.
|
|
39
30
|
* @returns {Promise<string | null>} Path to found ruleset file or null if none exists
|
|
40
31
|
*/
|
|
41
|
-
function findLocalRuleset() {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return foundPath;
|
|
47
|
-
}
|
|
32
|
+
async function findLocalRuleset() {
|
|
33
|
+
for (const fileName of SPECTRAL_RULESET_FILES) {
|
|
34
|
+
const foundPath = await (0, find_up_1.default)(fileName);
|
|
35
|
+
if (foundPath) {
|
|
36
|
+
return foundPath;
|
|
48
37
|
}
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
51
40
|
}
|
|
52
41
|
/**
|
|
53
42
|
* Resolves the Spectral ruleset location based on user input or directory search
|
|
54
43
|
* @param {string} [customPath] User-provided ruleset path
|
|
55
44
|
* @returns {Promise<string | null>} Path to custom ruleset, null for default ruleset
|
|
56
45
|
*/
|
|
57
|
-
function resolveRulesetPath(customPath) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return customPath;
|
|
63
|
-
});
|
|
46
|
+
async function resolveRulesetPath(customPath) {
|
|
47
|
+
if (!customPath) {
|
|
48
|
+
return await findLocalRuleset();
|
|
49
|
+
}
|
|
50
|
+
return customPath;
|
|
64
51
|
}
|
|
65
52
|
//# sourceMappingURL=config-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;AA6BH,gDAMC;AAjCD,sDAA6B;AAE7B,qDAAqD;AACrD,MAAM,sBAAsB,GAAG;IAC3B,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,cAAc;CACjB,CAAC;AAEF;;;GAGG;AACH,KAAK,UAAU,gBAAgB;IAC3B,KAAK,MAAM,QAAQ,IAAI,sBAAsB,EAAE,CAAC;QAC5C,MAAM,SAAS,GAAG,MAAM,IAAA,iBAAM,EAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,SAAS,EAAE,CAAC;YAAA,OAAO,SAAS,CAAC;QAAA,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,kBAAkB,CAAC,UAAmB;IACxD,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,OAAO,MAAM,gBAAgB,EAAE,CAAC;IACpC,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,15 +12,6 @@
|
|
|
12
12
|
* See the License for the specific language governing permissions and
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
15
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
16
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
17
|
};
|
|
@@ -55,19 +46,17 @@ function convertToJsonAST(model) {
|
|
|
55
46
|
* @param {string} [ruleset] - Custom ruleset path or 'default'
|
|
56
47
|
* @returns {Promise<Ruleset | RulesetDefinition>} Loaded ruleset
|
|
57
48
|
*/
|
|
58
|
-
function loadRuleset(ruleset) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return concerto_linter_default_ruleset_1.default;
|
|
63
|
-
}
|
|
64
|
-
const rulesetPath = yield (0, config_loader_1.resolveRulesetPath)(ruleset);
|
|
65
|
-
return rulesetPath ? yield (0, getRuleset_1.getRuleset)(rulesetPath) : concerto_linter_default_ruleset_1.default;
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
throw new Error(`Ruleset loading failed: ${error instanceof Error ? error.message : error}`);
|
|
49
|
+
async function loadRuleset(ruleset) {
|
|
50
|
+
try {
|
|
51
|
+
if (typeof ruleset === 'string' && ruleset.toLowerCase() === 'default') {
|
|
52
|
+
return concerto_linter_default_ruleset_1.default;
|
|
69
53
|
}
|
|
70
|
-
|
|
54
|
+
const rulesetPath = await (0, config_loader_1.resolveRulesetPath)(ruleset);
|
|
55
|
+
return rulesetPath ? await (0, getRuleset_1.getRuleset)(rulesetPath) : concerto_linter_default_ruleset_1.default;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
throw new Error(`Ruleset loading failed: ${error instanceof Error ? error.message : error}`);
|
|
59
|
+
}
|
|
71
60
|
}
|
|
72
61
|
/**
|
|
73
62
|
* Formats Spectral linting results by mapping them to a standardized lint result structure,
|
|
@@ -90,11 +79,10 @@ function formatResults(spectralResults, jsonAST, excludeNamespaces = ['concerto.
|
|
|
90
79
|
3: 'hint',
|
|
91
80
|
};
|
|
92
81
|
const results = spectralResults.map(r => {
|
|
93
|
-
var _a;
|
|
94
82
|
let namespace = 'unknown';
|
|
95
83
|
if (Array.isArray(r.path) && r.path.length >= 2 && r.path[0] === 'models') {
|
|
96
84
|
const modelIndex = r.path[1];
|
|
97
|
-
const modelEntry =
|
|
85
|
+
const modelEntry = ast.models?.[modelIndex];
|
|
98
86
|
if (modelEntry && modelEntry.namespace) {
|
|
99
87
|
namespace = modelEntry.namespace;
|
|
100
88
|
}
|
|
@@ -130,20 +118,18 @@ function formatResults(spectralResults, jsonAST, excludeNamespaces = ['concerto.
|
|
|
130
118
|
* @returns {Promise<lintResult[]>} Promise resolving to an array of formatted linting results as a JSON object.
|
|
131
119
|
* @throws {Error} Throws an error if linting or model conversion fails.
|
|
132
120
|
*/
|
|
133
|
-
function lintModel(model, config) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
});
|
|
121
|
+
async function lintModel(model, config) {
|
|
122
|
+
try {
|
|
123
|
+
const jsonAST = convertToJsonAST(model);
|
|
124
|
+
const ruleset = await loadRuleset(config?.ruleset);
|
|
125
|
+
const spectral = new spectral_core_1.Spectral();
|
|
126
|
+
spectral.setRuleset(ruleset);
|
|
127
|
+
const document = new spectral_core_1.Document(jsonAST, spectral_parsers_1.Json);
|
|
128
|
+
const spectralResults = await spectral.run(document);
|
|
129
|
+
return formatResults(spectralResults, jsonAST, config?.excludeNamespaces);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
throw new Error(`Linting process failed: ${error instanceof Error ? error.message : error}`);
|
|
133
|
+
}
|
|
148
134
|
}
|
|
149
135
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;AAiJH,8BAeC;AA9JD,4DAAuG;AACvG,kEAAkE;AAClE,mDAAqD;AACrD,8FAA2F;AAC3F,qHAA+E;AAC/E,8DAAqD;AA+BrD;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,KAAsB;IAC5C,IAAI,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,SAAS,GAAG,qBAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAClG,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,WAAW,CAAC,OAAgB;IACvC,IAAI,CAAC;QAED,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;YACrE,OAAO,yCAAe,CAAC;QAC3B,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,IAAA,kCAAkB,EAAC,OAAO,CAAC,CAAC;QACtD,OAAO,WAAW,CAAC,CAAC,CAAC,MAAM,IAAA,uBAAU,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC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W,CAAC,CAAC;QACpD,MAAM,eAAe,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO,aAAa,CAAC,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAE9E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IACjG,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@accordproject/concerto-linter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.1",
|
|
4
4
|
"description": "Concerto Linter using Spectral rulesets",
|
|
5
5
|
"homepage": "https://github.com/accordproject/concerto",
|
|
6
6
|
"engines": {
|
|
@@ -32,8 +32,10 @@
|
|
|
32
32
|
"author": "accordproject.org",
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"
|
|
36
|
-
"@accordproject/concerto-
|
|
35
|
+
"ajv": "^8.17.1",
|
|
36
|
+
"@accordproject/concerto-core": "4.0.0-beta.1",
|
|
37
|
+
"@accordproject/concerto-linter-default-ruleset": "4.0.0-beta.1",
|
|
38
|
+
"@accordproject/concerto-metamodel": "^4.0.0-alpha.0",
|
|
37
39
|
"find-up": "5.0.0",
|
|
38
40
|
"@stoplight/spectral-cli": "6.15.0",
|
|
39
41
|
"@stoplight/spectral-core": "1.20.0",
|
|
@@ -41,12 +43,12 @@
|
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"eslint": "8.57.1",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
45
|
-
"@typescript-eslint/parser": "8.
|
|
46
|
-
"npm-run-all": "4.1.5",
|
|
47
|
-
"rimraf": "6.0.1",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
47
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
48
|
+
"npm-run-all": "^4.1.5",
|
|
49
|
+
"rimraf": "^6.0.1",
|
|
48
50
|
"typescript": "5.7.2",
|
|
49
|
-
"jest": "29.7.0",
|
|
50
|
-
"ts-jest": "29.2.5"
|
|
51
|
+
"jest": "^29.7.0",
|
|
52
|
+
"ts-jest": "^29.2.5"
|
|
51
53
|
}
|
|
52
54
|
}
|
package/src/config-loader.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ describe('lintModel', () => {
|
|
|
16
16
|
test('should lint a valid model successfully', async () => {
|
|
17
17
|
const validModel = `
|
|
18
18
|
namespace com.example
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
concept Person {
|
|
21
21
|
o String firstName
|
|
22
22
|
o String lastName
|
|
@@ -35,7 +35,7 @@ describe('lintModel', () => {
|
|
|
35
35
|
test('should detect violations in problematic model', async () => {
|
|
36
36
|
const problematicModel = `
|
|
37
37
|
namespace com.example
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
concept class { // Reserved keyword as concept name
|
|
40
40
|
o String private // Reserved keyword as property name
|
|
41
41
|
}
|
|
@@ -63,7 +63,7 @@ describe('lintModel', () => {
|
|
|
63
63
|
test('should work with all configuration options', async () => {
|
|
64
64
|
const model = `
|
|
65
65
|
namespace com.example.test
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
concept ValidConcept {
|
|
68
68
|
o String validProperty
|
|
69
69
|
}
|
package/tsconfig.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
12
|
|
|
13
13
|
/* Language and Environment */
|
|
14
|
-
"target": "
|
|
14
|
+
"target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
15
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
16
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
17
|
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|