Skip to content
This repository was archived by the owner on Aug 13, 2020. It is now read-only.

Commit 4ad9dcb

Browse files
author
Jianing
committed
test
1 parent c0cf892 commit 4ad9dcb

File tree

12 files changed

+6222
-21
lines changed

12 files changed

+6222
-21
lines changed

.eslintrc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"plugin:@typescript-eslint/eslint-recommended",
6+
"prettier"
7+
],
8+
"parser": "@typescript-eslint/parser",
9+
"plugins": ["prettier", "@typescript-eslint"],
10+
"parserOptions": {
11+
"ecmaVersion": 6,
12+
"sourceType": "module",
13+
"impliedStrict": true
14+
},
15+
"rules": {
16+
"no-sparse-arrays": 0,
17+
"no-self-assign": 0,
18+
"no-unused-vars": 0, // @typescript-eslint/no-unused-vars
19+
"no-inner-declarations": 0,
20+
"prettier/prettier": 2,
21+
"@typescript-eslint/no-unused-vars": 1,
22+
"@typescript-eslint/no-non-null-assertion": 0,
23+
"@typescript-eslint/no-explicit-any": 0,
24+
"@typescript-eslint/no-use-before-define": [2, { "functions": false }],
25+
"@typescript-eslint/ban-ts-ignore": 0,
26+
"@typescript-eslint/interface-name-prefix": 0,
27+
"@typescript-eslint/no-empty-interface": 0,
28+
"@typescript-eslint/camelcase": 0,
29+
"@typescript-eslint/no-inferrable-types": 0,
30+
"@typescript-eslint/explicit-function-return-type": 0,
31+
"@typescript-eslint/type-annotation-spacing": 0,
32+
"@typescript-eslint/no-empty-function": 1
33+
}
34+
}

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
on: push
2+
jobs:
3+
lint:
4+
strategy:
5+
matrix:
6+
platform: [ubuntu-latest, macos-latest, windows-latest]
7+
runs-on: ${{ matrix.platform }}
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: actions/setup-node@v1
11+
with:
12+
version: 12
13+
- run: npm run lint

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
node_modules
1+
node_modules
2+
coverage
3+
*.log

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"bracketSpacing": true,
6+
"printWidth": 120,
7+
"arrowParens": "always"
8+
}

__tests__/query-spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Query } from '../src/query';
2+
3+
describe('query', () => {
4+
test('query', () => {
5+
const q = new Query([]);
6+
expect(q.record()).toEqual([]);
7+
});
8+
});

package-lock.json

Lines changed: 169 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"fix": "eslint --ext .ts ./src ./__tests__ --fix && prettier --write ./src ./__tests__",
8+
"lint": "eslint --ext .ts ./src ./__tests__",
9+
"test": "jest",
10+
"lint-staged": "lint-staged"
811
},
912
"repository": {
1013
"type": "git",
@@ -17,9 +20,49 @@
1720
},
1821
"homepage": "https://github.com/ProtoTeam/intern-repo#readme",
1922
"dependencies": {
23+
"@typescript-eslint/eslint-plugin": "^3.8.0",
2024
"lodash": "^4.17.19"
2125
},
2226
"devDependencies": {
23-
"@types/lodash": "^4.14.159"
27+
"@commitlint/cli": "^8.2.0",
28+
"@commitlint/config-angular": "^8.2.0",
29+
"@types/jest": "^26.0.9",
30+
"@types/lodash": "^4.14.159",
31+
"@typescript-eslint/eslint-plugin": "^2.0.0",
32+
"@typescript-eslint/parser": "^2.0.0",
33+
"conventional-changelog-cli": "^2.0.28",
34+
"eslint": "^7.6.0",
35+
"eslint-config-prettier": "^6.11.0",
36+
"eslint-plugin-prettier": "^3.1.0",
37+
"jest": "^26.2.2",
38+
"jest-extended": "^0.11.2",
39+
"lint-staged": "^10.0.7",
40+
"npm-run-all": "^4.1.5",
41+
"prettier": "^2.0.5",
42+
"ts-jest": "^25.4.0",
43+
"ts-loader": "^7.0.0",
44+
"typescript": "^3.9.7"
45+
},
46+
"jest": {
47+
"preset": "ts-jest",
48+
"collectCoverage": true,
49+
"collectCoverageFrom": [
50+
"src/**/*.ts",
51+
"!**/node_modules/**",
52+
"!**/vendor/**"
53+
],
54+
"testRegex": "/__tests__/.*-spec\\.ts?$"
55+
},
56+
"husky": {
57+
"hooks": {
58+
"pre-commit": "npm run lint",
59+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
60+
}
61+
},
62+
"lint-staged": {
63+
"*.ts": [
64+
"eslint --fix",
65+
"prettier --write"
66+
]
2467
}
2568
}

src/data-set.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Query } from './query';
44

55
/** 前端数据集模块 */
66
export class DataSet {
7-
87
private data = [];
98

109
constructor(data: Data) {
@@ -31,4 +30,4 @@ export class DataSet {
3130
public query() {
3231
return new Query(this.data);
3332
}
34-
}
33+
}

src/field.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Field } from './types';
22

33
/**
44
* 聚合求和
5-
* @param field
5+
* @param field
66
*/
77
export function SUM(field: string): Field {
88
return {
@@ -13,7 +13,7 @@ export function SUM(field: string): Field {
1313

1414
/**
1515
* 聚合 MAX
16-
* @param field
16+
* @param field
1717
*/
1818
export function MAX(field: string): Field {
1919
return {
@@ -24,7 +24,7 @@ export function MAX(field: string): Field {
2424

2525
/**
2626
* 聚合 MIN
27-
* @param field
27+
* @param field
2828
*/
2929
export function MIN(field: string): Field {
3030
return {
@@ -35,11 +35,11 @@ export function MIN(field: string): Field {
3535

3636
/**
3737
* 无聚合字段
38-
* @param field
38+
* @param field
3939
*/
4040
export function RAW(field: string): Field {
4141
return {
4242
aggregate: 'raw',
4343
field,
4444
};
45-
}
45+
}

0 commit comments

Comments
 (0)