mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +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}`);
|
||||
const jisonCode = await readFile(file, 'utf8');
|
||||
// @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);
|
||||
if (result.errorCount > 0) {
|
||||
console.error(`Linting failed for ${file}`);
|
||||
console.error(result.messages);
|
||||
}
|
||||
if (generator.conflicts > 0) {
|
||||
console.error(`Linting failed for ${file}. Conflicts found in grammar`);
|
||||
return false;
|
||||
}
|
||||
return result.errorCount === 0;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user