Skip to content

Commit b78bb22

Browse files
author
Sven Ulrich
committed
updatedeps: added eslint
1 parent 18626f7 commit b78bb22

File tree

5 files changed

+1628
-772
lines changed

5 files changed

+1628
-772
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.js
2+
*.d.ts

.eslintrc.json

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

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
],
1010
"scripts": {
1111
"test": "mocha -r ts-node/register tests/**/tests.ts",
12-
"build": "gulp default && gulp compress"
13-
},
14-
"repository": {
15-
"type": "git",
16-
"url": "https://github.com/sevensc/typescript-string-operations.git"
12+
"build": "gulp default && gulp compress",
13+
"lint": "eslint ."
1714
},
15+
"repository": "https://github.com/sevensc/typescript-string-operations.git",
1816
"keywords": [
1917
"typescript",
2018
"string format",
@@ -29,10 +27,12 @@
2927
"url": "https://github.com/sevensc/typescript-string-operations/issues"
3028
},
3129
"homepage": "https://github.com/sevensc/typescript-string-operations#readme",
32-
"dependencies": {},
3330
"devDependencies": {
3431
"@types/chai": "^4.2.7",
3532
"@types/mocha": "^2.2.48",
33+
"@typescript-eslint/eslint-plugin": "^5.34.0",
34+
"@typescript-eslint/parser": "^5.34.0",
35+
"eslint": "^8.22.0",
3636
"chai": "^4.2.0",
3737
"gulp": "^4.0.2",
3838
"gulp-rename": "^1.4.0",

tests/tests.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('String.IsNullOrWhitespace', () => {
77

88
it('should return true on null string', () => {
99
let teststring = null;
10-
let result = String.IsNullOrWhiteSpace(teststring);
10+
let result = String.IsNullOrWhiteSpace(teststring!);
1111
expect(result).to.equal(true);
1212
});
1313

@@ -183,7 +183,7 @@ describe('String.Format Number Pattern', () => {
183183
expect(result).to.equal(expectedValue);
184184
});
185185
});
186-
186+
187187
describe('hexadecimal', () => {
188188
it('number should be converted to hex lowercase', () => {
189189
let result = String.Format('{0:x}', 500);
@@ -276,7 +276,7 @@ describe('StringBuilder initialization', () => {
276276
builder.Append('Second Part...');
277277

278278
expect(builder.ToString()).to
279-
.equal('First Part... Second Part...');
279+
.equal('First Part... Second Part...');
280280
});
281281

282282
it('should add a string if there is ctor parameter', () => {
@@ -285,7 +285,7 @@ describe('StringBuilder initialization', () => {
285285

286286
console.log(builder.ToString());
287287
expect(builder.ToString()).to
288-
.equal('First Part... Second Part...');
288+
.equal('First Part... Second Part...');
289289
});
290290
});
291291

@@ -296,7 +296,7 @@ describe('StringBuilderng.Append', () => {
296296
builder.Append('Second Part...');
297297

298298
expect(builder.ToString()).to
299-
.equal('First Part... Second Part...');
299+
.equal('First Part... Second Part...');
300300
});
301301

302302
it('should append characters', () => {
@@ -306,7 +306,7 @@ describe('StringBuilderng.Append', () => {
306306

307307
console.log(builder.ToString());
308308
expect(builder.ToString()).to
309-
.equal('First Part... Second Part...');
309+
.equal('First Part... Second Part...');
310310
});
311311
});
312312

@@ -317,7 +317,7 @@ describe('StringBuilder.AppendLine', () => {
317317
builder.AppendLine('Second Line...');
318318

319319
expect(builder.ToString()).to
320-
.equal('\r\nFirst Line...\r\nSecond Line...');
320+
.equal('\r\nFirst Line...\r\nSecond Line...');
321321
});
322322

323323
it('should append characters and new line', () => {
@@ -327,7 +327,7 @@ describe('StringBuilder.AppendLine', () => {
327327

328328
console.log(builder.ToString());
329329
expect(builder.ToString()).to
330-
.equal('\r\nFirst Line...\r\nSecond Line...');
330+
.equal('\r\nFirst Line...\r\nSecond Line...');
331331
});
332332

333333
it('should append characters and new line', () => {
@@ -337,6 +337,6 @@ describe('StringBuilder.AppendLine', () => {
337337

338338
console.log(builder.ToString());
339339
expect(builder.ToString()).to
340-
.equal('\r\nFirst Line...\r\nSecond Line...');
340+
.equal('\r\nFirst Line...\r\nSecond Line...');
341341
});
342342
});

0 commit comments

Comments
 (0)