mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-02-04 07:13:25 +08:00
Check for conflict when linting jison
This commit is contained in:
parent
d09151e870
commit
d125d22488
@ -14,12 +14,17 @@ const lint = async (file: string): Promise<boolean> => {
|
|||||||
console.log(`Linting ${file}`);
|
console.log(`Linting ${file}`);
|
||||||
const jisonCode = await readFile(file, 'utf8');
|
const jisonCode = await readFile(file, 'utf8');
|
||||||
// @ts-ignore no typings
|
// @ts-ignore no typings
|
||||||
const jsCode = new jison.Generator(jisonCode, { moduleType: 'amd' }).generate();
|
const generator = new jison.Generator(jisonCode, { moduleType: 'amd' });
|
||||||
|
const jsCode = generator.generate();
|
||||||
const [result] = await linter.lintText(jsCode);
|
const [result] = await linter.lintText(jsCode);
|
||||||
if (result.errorCount > 0) {
|
if (result.errorCount > 0) {
|
||||||
console.error(`Linting failed for ${file}`);
|
console.error(`Linting failed for ${file}`);
|
||||||
console.error(result.messages);
|
console.error(result.messages);
|
||||||
}
|
}
|
||||||
|
if (generator.conflicts > 0) {
|
||||||
|
console.error(`Linting failed for ${file}. Conflicts found in grammar`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return result.errorCount === 0;
|
return result.errorCount === 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user