chroe: devops (#180)

* ci: add dependencies about lint tool

* ci: replace eslint with prettier

* ci: add husky, cz and commitlint

* style: lint fix via prettier

* ci: add prettier and check-types to github workflow

'
This commit is contained in:
Hayden
2023-10-13 11:16:36 +08:00
committed by GitHub
parent 4d1dfa676f
commit 7de192d486
105 changed files with 2615 additions and 1823 deletions

View File

@ -1,5 +1,5 @@
import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
const features = {
table: readSQL(__dirname, 'alterTable.sql'),
@ -26,11 +26,10 @@ describe('FlinkSQL Alter Statements Syntax Tests', () => {
expect(parser.validate(sql).length).toBe(0);
});
});
features.function.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
});
});

View File

@ -1,9 +1,9 @@
import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
// 综合测试的 sql 不做切割
const features = {
chores: readSQL(__dirname, 'chore.sql')
chores: readSQL(__dirname, 'chore.sql'),
};
describe('FlinkSQL Chore Syntax Tests', () => {

View File

@ -1,10 +1,10 @@
import fs from 'fs';
import path from 'path';
import FlinkSQL from "../../../../src/parser/flinksql";
import FlinkSQL from '../../../../src/parser/flinksql';
// 注释 sql 不做切割
const features = {
comments: fs.readFileSync(path.join(__dirname, 'fixtures', 'comment.sql'), 'utf-8')
comments: fs.readFileSync(path.join(__dirname, 'fixtures', 'comment.sql'), 'utf-8'),
};
describe('FlinkSQL Comment Syntax Tests', () => {

View File

@ -1,10 +1,10 @@
import fs from 'fs';
import path from 'path';
import FlinkSQL from "../../../../src/parser/flinksql";
import FlinkSQL from '../../../../src/parser/flinksql';
// 综合测试的 sql 不做切割
const features = {
templates: fs.readFileSync(path.join(__dirname, 'fixtures', 'templates.sql'), 'utf-8')
templates: fs.readFileSync(path.join(__dirname, 'fixtures', 'templates.sql'), 'utf-8'),
};
describe('FlinkSQL Comprehensive Tests', () => {
@ -13,4 +13,3 @@ describe('FlinkSQL Comprehensive Tests', () => {
expect(parser.validate(features.templates).length).toBe(0);
});
});

View File

@ -1,8 +1,8 @@
import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
const features = {
describes: readSQL(__dirname, 'describe.sql')
describes: readSQL(__dirname, 'describe.sql'),
};
describe('FlinkSQL Describe Syntax Tests', () => {

View File

@ -1,5 +1,5 @@
import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
const features = {
table: readSQL(__dirname, 'dropTable.sql'),
@ -30,7 +30,7 @@ describe('FlinkSQL Drop Statements Tests', () => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
});
});
features.database.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);

View File

@ -1,8 +1,8 @@
import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
const features = {
dtAddFiles: readSQL(__dirname, 'dtAddFile.sql')
dtAddFiles: readSQL(__dirname, 'dtAddFile.sql'),
};
describe('FlinkSQL DT Add File Syntax Tests', () => {

View File

@ -1,8 +1,8 @@
import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
const features = {
explains: readSQL(__dirname, 'explain.sql')
explains: readSQL(__dirname, 'explain.sql'),
};
describe('FlinkSQL Explain Syntax Tests', () => {

View File

@ -1,13 +1,12 @@
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
const parser = new FlinkSQL();
const features = {
InsertFromSelectQueries: readSQL(__dirname, 'insertFromSelectQueries.sql'),
InsertValuesIntoTable: readSQL(__dirname, 'insertValuesIntoTable.sql'),
InsertMultipleTable: readSQL(__dirname, 'insertMultipleTable.sql')
InsertMultipleTable: readSQL(__dirname, 'insertMultipleTable.sql'),
};
describe('FlinkSQL Insert Syntax Tests', () => {

View File

@ -1,22 +1,22 @@
import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
const parser = new FlinkSQL();
const features = {
base: readSQL(__dirname, "select.sql"),
withClause: readSQL(__dirname, "selectWithClause.sql"),
distinct: readSQL(__dirname, "selectDistinct.sql"),
windowTVF: readSQL(__dirname, "selectWindowTVF.sql"),
aggregation: readSQL(__dirname, "selectAggregation.sql"),
join: readSQL(__dirname, "selectJoin.sql"),
setOperation: readSQL(__dirname, "selectSetOperations.sql"),
pattern: readSQL(__dirname, "selectPatternRecognition.sql"),
where: readSQL(__dirname, "selectWhere.sql"),
base: readSQL(__dirname, 'select.sql'),
withClause: readSQL(__dirname, 'selectWithClause.sql'),
distinct: readSQL(__dirname, 'selectDistinct.sql'),
windowTVF: readSQL(__dirname, 'selectWindowTVF.sql'),
aggregation: readSQL(__dirname, 'selectAggregation.sql'),
join: readSQL(__dirname, 'selectJoin.sql'),
setOperation: readSQL(__dirname, 'selectSetOperations.sql'),
pattern: readSQL(__dirname, 'selectPatternRecognition.sql'),
where: readSQL(__dirname, 'selectWhere.sql'),
};
describe("FlinkSQL Query Statement Tests", () => {
describe("Base Select", () => {
describe('FlinkSQL Query Statement Tests', () => {
describe('Base Select', () => {
features.base.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
@ -24,7 +24,7 @@ describe("FlinkSQL Query Statement Tests", () => {
});
});
describe("With Clause Select", () => {
describe('With Clause Select', () => {
features.withClause.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
@ -32,60 +32,59 @@ describe("FlinkSQL Query Statement Tests", () => {
});
});
describe("Select DISTINCT", () => {
describe('Select DISTINCT', () => {
features.distinct.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
});
});
describe("Select Window TVF", () => {
describe('Select Window TVF', () => {
features.windowTVF.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
});
});
describe("Select Aggregation", () => {
describe('Select Aggregation', () => {
features.aggregation.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
});
});
describe("Select Join", () => {
describe('Select Join', () => {
features.join.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
});
});
describe("Select Set Operations", () => {
describe('Select Set Operations', () => {
features.setOperation.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
});
});
describe("Select Pattern Recognition", () => {
describe('Select Pattern Recognition', () => {
features.pattern.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
});
});
describe("Select Where", () => {
describe('Select Where', () => {
features.where.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0)
})
})
})
expect(parser.validate(sql).length).toBe(0);
});
});
});
});

View File

@ -1,8 +1,8 @@
import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
const features = {
shows: readSQL(__dirname, 'show.sql')
shows: readSQL(__dirname, 'show.sql'),
};
describe('FlinkSQL Show Syntax Tests', () => {

View File

@ -1,13 +1,13 @@
import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
import FlinkSQL from '../../../../src/parser/flinksql';
import { readSQL } from '../../../helper';
const features = {
uses: readSQL(__dirname, 'use.sql')
uses: readSQL(__dirname, 'use.sql'),
};
describe('FlinkSQL Use Syntax Tests', () => {
const parser = new FlinkSQL();
const parser = new FlinkSQL();
features.uses.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);