Skip to content

Commit e328dbb

Browse files
committed
Chore lint code.
Chore update README.md Update remove env specifics in typescript
1 parent 7e46777 commit e328dbb

20 files changed

+283
-255
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# 1.0.1
2+
[link](https://github.com/weirdpattern/eslint-config-typescript/compare/1.0.0...1.0.1)
3+
4+
* Chore lint code.
5+
* Chore update README.md
6+
* Update remove env specifics in typescript
7+
8+
# 1.0.0
9+
Initial Release

README.md

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,59 @@ A few ESLint plugins are supported as well:
3131
```
3232

3333
## Example configuration
34+
Using default prettier configurations:
3435
```json
3536
{
3637
"extends": [
3738
"typescript",
3839
"typescript/react",
3940
"typescript/prettier"
4041
],
41-
"plugins": [
42-
"typescript"
43-
],
44-
"parserOptions": {
45-
"ecmaVersion": 2016,
46-
"sourceType": "module",
47-
"ecmaFeatures": {
48-
"jsx": true
49-
}
42+
"plugins": ["filenames", "jest"],
43+
"env": {
44+
"jest": true,
45+
"node": true
5046
},
51-
"env": {
52-
"es6": true,
47+
"rules": {
48+
"filenames/no-index": "error",
49+
"filenames/match-exported": ["error", "kebab"],
50+
"jest/no-disabled-tests": "error",
51+
"jest/no-focused-tests": "error",
52+
"jest/no-identical-title": "error",
53+
"jest/valid-expect": "error"
54+
}
55+
}
56+
```
57+
58+
Using specific prettier configurations:
59+
```json
60+
{
61+
"extends": [
62+
"typescript",
63+
"typescript/react",
64+
"typescript/prettier"
65+
],
66+
"plugins": ["filenames", "jest"],
67+
"env": {
68+
"jest": true,
5369
"node": true
70+
},
71+
"rules": {
72+
"filenames/no-index": "error",
73+
"filenames/match-exported": ["error", "kebab"],
74+
"jest/no-disabled-tests": "error",
75+
"jest/no-focused-tests": "error",
76+
"jest/no-identical-title": "error",
77+
"jest/valid-expect": "error",
78+
"prettier/prettier": [
79+
"error",
80+
{
81+
"semi": false,
82+
"tabWidth": 4,
83+
"singleQuote": true,
84+
"parser": "typescript"
85+
}
86+
]
5487
}
5588
}
5689
```

eslint.config.js

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
'use strict';
9+
"use strict";
1010

1111
module.exports = {
12-
extends: ['eslint:recommended', 'prettier'],
13-
plugins: ['prettier', 'filenames'],
12+
extends: ["eslint:recommended", "prettier"],
13+
plugins: ["prettier", "filenames"],
1414
parserOptions: {
15-
sourceType: 'module',
15+
sourceType: "module",
1616
ecmaVersion: 2015,
1717
ecmaFeatures: {
1818
jsx: true
@@ -24,41 +24,35 @@ module.exports = {
2424
jest: true
2525
},
2626
rules: {
27-
semi: 'error',
28-
'no-undef': 'off',
29-
'no-unused-vars': 'off',
30-
'require-jsdoc': 'error',
31-
'no-console': [
32-
'error',
27+
semi: "error",
28+
"no-undef": "off",
29+
"no-unused-vars": "off",
30+
"require-jsdoc": "error",
31+
"no-console": [
32+
"error",
3333
{
34-
allow: ['warn', 'error']
34+
allow: ["warn", "error"]
3535
}
3636
],
37-
'valid-jsdoc': [
38-
'error',
37+
"valid-jsdoc": [
38+
"error",
3939
{
4040
preferType: {
41-
any: '*',
42-
object: 'Object'
41+
any: "*",
42+
object: "Object"
4343
},
4444
requireReturnType: true,
4545
requireParamDescription: true,
4646
requireReturnDescription: true
4747
}
4848
],
49-
quotes: ['error', 'single', { avoidEscape: true }],
50-
'jsx-quotes': ['error', 'prefer-single'],
51-
'filenames/match-exported': ['error', 'kebab'],
52-
'prettier/prettier': [
53-
'error',
49+
quotes: ["error", "double", { avoidEscape: true }],
50+
"jsx-quotes": ["error", "prefer-single"],
51+
"filenames/match-exported": ["error", "kebab"],
52+
"prettier/prettier": [
53+
"error",
5454
{
55-
semi: true,
56-
tabWidth: 2,
57-
singleQuote: true,
58-
bracketSpacing: true,
59-
jsxBracketSameLine: true,
60-
printWidth: 80,
61-
parser: 'typescript'
55+
parser: "typescript"
6256
}
6357
]
6458
}

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
'use strict';
9+
"use strict";
1010

11-
module.exports = require('./src/typescript');
11+
module.exports = require("./src/typescript");

jest.config.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
'use strict';
9+
"use strict";
1010

1111
module.exports = {
12-
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
12+
moduleFileExtensions: ["js", "jsx", "ts", "tsx"],
1313
testMatch: [
14-
'<rootDir>/specs/*[.-][Ss]pec[s]?.{j,t}s{,x}',
15-
'<rootDir>/specs/**/*[.-][Ss]pec[s]?.{j,t}s{,x}'
14+
"<rootDir>/specs/*[.-][Ss]pec[s]?.{j,t}s{,x}",
15+
"<rootDir>/specs/**/*[.-][Ss]pec[s]?.{j,t}s{,x}"
1616
],
17-
rootDir: '.',
17+
rootDir: ".",
1818
verbose: false,
1919
resetMocks: true,
2020
resetModules: true,
2121
collectCoverage: false,
2222
collectCoverageFrom: [
23-
'{index,prettier,react}.{j,t}s{,x}',
24-
'src/*.{j,t}s{,x}',
25-
'!**/*.min.js',
26-
'!**/static/**',
27-
'!**/specs/**',
28-
'!**/node_modules/**'
23+
"{index,prettier,react}.{j,t}s{,x}",
24+
"src/*.{j,t}s{,x}",
25+
"!**/*.min.js",
26+
"!**/static/**",
27+
"!**/specs/**",
28+
"!**/node_modules/**"
2929
]
3030
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"license": "MIT",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"name": "eslint-config-typescript",
55
"description": "An opinionated set of ESLint rules for TypeScript projects",
66
"author": "Patricio Trevino <patricio@weirdpattern.com>",

prettier.config.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
'use strict';
9+
"use strict";
1010

1111
module.exports = {
12-
semi: true,
13-
tabWidth: 2,
14-
singleQuote: true,
15-
bracketSpacing: true,
16-
jsxBracketSameLine: true,
17-
printWidth: 80
12+
parser: "typescript"
1813
};

prettier.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
'use strict';
9+
"use strict";
1010

11-
module.exports = require('./src/prettier');
11+
module.exports = require("./src/prettier");

react.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
'use strict';
9+
"use strict";
1010

11-
module.exports = require('./src/react');
11+
module.exports = require("./src/react");

specs/config.prettier.specs.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
1-
'use strict';
1+
"use strict";
22

3-
const fs = require('fs');
4-
const path = require('path');
5-
const childProcess = require('child_process');
3+
const fs = require("fs");
4+
const path = require("path");
5+
const childProcess = require("child_process");
66

7-
describe('config', () => {
8-
it('samples does not causes errors without eslint-config-typescript/prettier', () => {
7+
describe("config", () => {
8+
it("samples does not causes errors without eslint-config-typescript/prettier", () => {
99
const result = childProcess.spawnSync(
10-
'npm',
10+
"npm",
1111
[
12-
'run',
13-
'test:spec',
14-
'--silent',
15-
'--',
16-
'--no-ignore',
17-
'--config',
18-
'./specs/configs/base.js',
19-
'./specs/samples/prettier.ts'
12+
"run",
13+
"test:spec",
14+
"--silent",
15+
"--",
16+
"--no-ignore",
17+
"--config",
18+
"./specs/configs/base.js",
19+
"./specs/samples/prettier.ts"
2020
],
21-
{ encoding: 'utf8' }
21+
{ encoding: "utf8" }
2222
);
2323
const output = JSON.parse(
24-
result.stdout.substring(result.stdout.indexOf('['))
24+
result.stdout.substring(result.stdout.indexOf("["))
2525
);
2626

2727
expect(output.length).toBe(1);
2828
expect(output[0].messages.length).toBe(0);
2929
});
3030

31-
it('samples causes errors with eslint-config-typescript/prettier', () => {
31+
it("samples causes errors with eslint-config-typescript/prettier", () => {
3232
const result = childProcess.spawnSync(
33-
'npm',
33+
"npm",
3434
[
35-
'run',
36-
'test:spec',
37-
'--silent',
38-
'--',
39-
'--no-ignore',
40-
'--config',
41-
'./specs/configs/prettier.js',
42-
'./specs/samples/prettier.ts'
35+
"run",
36+
"test:spec",
37+
"--silent",
38+
"--",
39+
"--no-ignore",
40+
"--config",
41+
"./specs/configs/prettier.js",
42+
"./specs/samples/prettier.ts"
4343
],
44-
{ encoding: 'utf8' }
44+
{ encoding: "utf8" }
4545
);
4646
const output = JSON.parse(
47-
result.stdout.substring(result.stdout.indexOf('['))
47+
result.stdout.substring(result.stdout.indexOf("["))
4848
);
4949

5050
expect(output.length).toBe(1);
5151
expect(output[0].messages.length).toBe(1);
5252
});
5353

54-
it('returns all rules', () => {
55-
const config = require('../prettier');
54+
it("returns all rules", () => {
55+
const config = require("../prettier");
5656

5757
expect(config).toBeDefined();
58-
expect(config.extends).toContain('prettier');
59-
expect(config.extends).toContain('prettier/react');
60-
expect(config.plugins).toContain('prettier');
58+
expect(config.extends).toContain("prettier");
59+
expect(config.extends).toContain("prettier/react");
60+
expect(config.plugins).toContain("prettier");
6161
expect(config.rules).toBeDefined();
62-
expect(config.rules['prettier/prettier']).toBeDefined();
63-
expect(config.rules['prettier/prettier'][0]).toBe('error');
64-
expect(config.rules['prettier/prettier'][1]).toMatchObject({
65-
parser: 'typescript'
62+
expect(config.rules["prettier/prettier"]).toBeDefined();
63+
expect(config.rules["prettier/prettier"][0]).toBe("error");
64+
expect(config.rules["prettier/prettier"][1]).toMatchObject({
65+
parser: "typescript"
6666
});
6767
});
6868
});

0 commit comments

Comments
 (0)