Skip to content

Commit dac783f

Browse files
committed
Add linting
1 parent c9b9d8d commit dac783f

8 files changed

+287
-9
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.eslintrc.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"env":{
3+
"browser":true,
4+
"es2021":true
5+
},
6+
"extends":[
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"prettier"
10+
],
11+
"parser":"@typescript-eslint/parser",
12+
"parserOptions":{
13+
"ecmaVersion":"latest",
14+
"sourceType":"module"
15+
},
16+
"plugins":[
17+
"@typescript-eslint"
18+
],
19+
"rules":{
20+
"linebreak-style":[
21+
"error",
22+
"unix"
23+
],
24+
"quotes":[
25+
"error",
26+
"single"
27+
],
28+
"semi":[
29+
"error",
30+
"always"
31+
]
32+
}
33+
}

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

.vscode/extensions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"nrwl.angular-console",
4+
"esbenp.prettier-vscode",
5+
"firsttris.vscode-jest-runner",
6+
"dbaeumer.vscode-eslint"
7+
]
8+
}

jest.config.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ export default {
2323
// collectCoverageFrom: undefined,
2424

2525
// The directory where Jest should output its coverage files
26-
coverageDirectory: "coverage",
26+
coverageDirectory: 'coverage',
2727

2828
// An array of regexp pattern strings used to skip coverage collection
2929
// coveragePathIgnorePatterns: [
3030
// "/node_modules/"
3131
// ],
3232

3333
// Indicates which provider should be used to instrument code for coverage
34-
coverageProvider: "v8",
34+
coverageProvider: 'v8',
3535

3636
// A list of reporter names that Jest uses when writing coverage reports
3737
// coverageReporters: [
@@ -100,7 +100,7 @@ export default {
100100
// notifyMode: "failure-change",
101101

102102
// A preset that is used as a base for Jest's configuration
103-
preset: "ts-jest",
103+
preset: 'ts-jest',
104104

105105
// Run tests from one or more projects
106106
// projects: undefined,
@@ -144,7 +144,7 @@ export default {
144144
// snapshotSerializers: [],
145145

146146
// The test environment that will be used for testing
147-
testEnvironment: "node",
147+
testEnvironment: 'node',
148148

149149
// Options that will be passed to the testEnvironment
150150
// testEnvironmentOptions: {},

package-lock.json

+229
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"types": "./dist/types/index.d.ts",
77
"scripts": {
88
"test": "jest",
9+
"lint": "eslint ./",
910
"postbuild": "cp ./package.esm.json ./dist/esm/package.json",
1011
"build": "rm -R ./dist && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json"
1112
},
@@ -38,6 +39,8 @@
3839
"devDependencies": {
3940
"@types/jest": "^27.5.0",
4041
"@types/node": "^17.0.31",
42+
"@typescript-eslint/eslint-plugin": "^5.23.0",
43+
"@typescript-eslint/parser": "^5.23.0",
4144
"eslint": "^8.14.0",
4245
"eslint-config-prettier": "^8.5.0",
4346
"eslint-plugin-jest": "^26.1.5",

test/index.spec.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { greet } from "../src/index";
1+
import { greet } from '../src/index';
22

3-
describe("greet", () => {
4-
it("should return greeting", () => {
5-
const result = greet("hi");
6-
expect(result).toEqual("hi");
3+
describe('greet', () => {
4+
it('should return greeting', () => {
5+
const result = greet('hi');
6+
expect(result).toEqual('hi');
77
});
88
});

0 commit comments

Comments
 (0)