Skip to content

Commit 754c2ab

Browse files
chore(release): 129.0.0
1 parent e636a4c commit 754c2ab

File tree

17 files changed

+1352
-336
lines changed

17 files changed

+1352
-336
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module.exports = {
44
extends: [
5+
"./lib/config/jsdoc-typescript.js",
56
"./lib/config/script.js",
67
"./lib/config/esnext.js",
78
"./lib/config/node.js",

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
This project adheres to [Semantic Versioning](http://semver.org). Except add new
66
rule (it is breaking changed by default).
77

8+
## 129.0.0 - 2020-09-29
9+
10+
- Added: `jsdoc-typescript` preset.
11+
- Update `ecmaVersion` to `2021`
12+
- Changed: disabled `class-methods-use-this` rule.
13+
- Changed: minimum required `eslint` version is now `7.10.0`.
14+
- Changed: minimum required `eslint-plugin-import` version is now `2.22.1`.
15+
- Changed: minimum required `eslint-plugin-jest` version is now `24.0.0`.
16+
- Changed: minimum required `eslint-plugin-react` version is now `7.21.2`.
17+
- Changed: minimum required `eslint-plugin-unicorn` version is now `22.0.0`.
18+
819
## 128.0.0 - 2020-09-09
920

1021
- Added: `jest/no-done-callback` rule (instead `no-test-callback` rule).

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ Example of configuration:
110110
```js
111111
import eslint from "eslint";
112112

113+
/**
114+
* @param {string} configName Config name
115+
* @returns {object} Config
116+
*/
113117
function loadConfig(configName) {
114118
// eslint-disable-next-line node/global-require, import/no-dynamic-require
115119
return require(`my-${configName}`);
@@ -231,8 +235,7 @@ Don't forget to add `--ext ".js,.md` for CLI usage.
231235
232236
This plugin also provides the following tool-specific configurations, which can be used on top of the core configurations:
233237
234-
- [AVA](lib/config/ava.js): Use this for projects that use the
235-
[AVA](https://github.com/sindresorhus/ava).
238+
- [AVA](lib/config/ava.js): Use this for projects that use the [AVA](https://github.com/sindresorhus/ava).
236239
237240
Example of configuration:
238241
@@ -248,8 +251,7 @@ module.exports = {
248251
};
249252
```
250253
251-
- [Jest](lib/config/jest.js): Use this for projects that use the
252-
[Jest](https://github.com/facebook/jest).
254+
- [Jest](lib/config/jest.js): Use this for projects that use the [Jest](https://github.com/facebook/jest).
253255
254256
Example of configuration:
255257
@@ -265,8 +267,7 @@ module.exports = {
265267
};
266268
```
267269
268-
- [lodash](lib/config/lodash.js): Use this for projects that use
269-
[lodash](https://lodash.com).
270+
- [lodash](lib/config/lodash.js): Use this for projects that use [lodash](https://lodash.com).
270271
271272
Example of configuration:
272273
@@ -281,6 +282,21 @@ module.exports = {
281282
};
282283
```
283284
285+
- [jsdoc-typescript](lib/config/jsdoc-typescript.js): Use this for projects that use JSDoc [typescript](https://www.typescriptlang.org).
286+
287+
Example of configuration:
288+
289+
```js
290+
module.exports = {
291+
extends: [
292+
"plugin:itgalaxy/jsdoc-typescript",
293+
"plugin:itgalaxy/module",
294+
"plugin:itgalaxy/esnext",
295+
"plugin:itgalaxy/node",
296+
],
297+
};
298+
```
299+
284300
## Examples
285301
286302
### CommonJS package for Node.js
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/**
2+
* Description
3+
*
4+
* @param {number} a Number
5+
* @param {number} b Number
6+
* @returns {number} Sum of numbers
7+
*/
8+
function sum(a, b) {
9+
return a + b;
10+
}
11+
12+
/**
13+
* @typedef {object} SpecialType1 Creates a new type named 'SpecialType'
14+
* @property {string} prop1 A string property of SpecialType
15+
* @property {number} prop2 A number property of SpecialType
16+
* @property {number} [number=666] prop3 An optional number property of SpecialType
17+
*/
18+
19+
/** @type {SpecialType1} */
20+
const specialTypeObject1 = { prop1: "foo", prop2: 123 };
21+
22+
/**
23+
* @returns {{ a: string, b: number }} Returned value
24+
*/
25+
function ab() {
26+
return { a: "a", b: 12 };
27+
}
28+
29+
/**
30+
* @returns {PromiseLike<string>} Promised value.
31+
*/
32+
function ps() {
33+
return Promise.resolve("test");
34+
}
35+
36+
/** @type {Map<string, () => Promise<string>>} */
37+
const pendingIdleTasks = new Map();
38+
39+
/**
40+
* @type {string}
41+
*/
42+
const string = "Hello world";
43+
44+
/**
45+
* @type {(string | boolean)}
46+
*/
47+
const sb1 = true;
48+
49+
/**
50+
* @type {string | boolean}
51+
*/
52+
const sb2 = "hello";
53+
54+
/** @type {number[]} */
55+
const ns = [1, 2, 3];
56+
/** @type {Array.<number>} */
57+
const nds = [1, 2, 3];
58+
/** @type {Array<number>} */
59+
const nas = [1, 2, 3];
60+
61+
/** @type {{ a: string, b: number }} */
62+
const var9 = { a: "str", b: 1 };
63+
64+
/**
65+
* A map-like object that maps arbitrary `string` properties to `number`s.
66+
*
67+
* @type {Object.<string, number>}
68+
*/
69+
const stringToNumber = { test: 123 };
70+
71+
/** @type {Object.<number, object>} */
72+
const arrayLike = [];
73+
74+
arrayLike[1] = { foo: "bar" };
75+
76+
/** @type {function(string, boolean): number} Closure syntax */
77+
const sbn = (one, two) => (two ? 1 : Number.parseInt(one, 10));
78+
/** @type {(s: string, b: boolean) => number} TypeScript syntax */
79+
const sbn2 = (one, two) => (two ? 1 : Number.parseInt(one, 10));
80+
/** @type {(s: string, b?: boolean) => number} TypeScript syntax */
81+
const sbn3 = (one, two) => (two ? 1 : Number.parseInt(one, 10));
82+
83+
/** @type {Function} */
84+
const fn7 = () => "string";
85+
86+
/**
87+
* @type {*} - can be 'any' type
88+
*/
89+
const star = {};
90+
/**
91+
* @type {?} - unknown type (same as 'any')
92+
*/
93+
const question = null;
94+
95+
/**
96+
* @type {number | string}
97+
*/
98+
const numberOrString = Math.random() < 0.5 ? "hello" : 100;
99+
const typeAssertedNumber = /** @type {number} */ (numberOrString);
100+
101+
/** @enum {number} */
102+
const JSDocState = {
103+
BeginningOfLine: 0,
104+
SawAsterisk: 1,
105+
SavingComments: 2,
106+
};
107+
108+
/**
109+
* @param {string} p1 A string param.
110+
* @param {string} [p2] p2 An optional param (Closure syntax)
111+
* @param {string} [p3] Another optional param (JSDoc syntax).
112+
* @param {string} [p4="test"] An optional param with a default value
113+
* @returns {string} This is the result
114+
*/
115+
function stringsStringStrings(p1, p2, p3, p4 = "test") {
116+
return p1 + p2 + p3 + p4;
117+
}
118+
119+
class MyClass {
120+
/**
121+
* @param {string} data String
122+
*/
123+
constructor(data) {
124+
// property types can be inferred
125+
this.name = "foo";
126+
127+
// or set explicitly
128+
/** @type {string | null} */
129+
this.title = null;
130+
131+
// or simply annotated, if they're set elsewhere
132+
/** @type {number} */
133+
this.size = 0;
134+
135+
this.initialize(data); // Should error, initializer expects a string
136+
}
137+
138+
/**
139+
* @param {string} value String
140+
*/
141+
initialize = function (value) {
142+
this.size = value.length;
143+
};
144+
}
145+
146+
/**
147+
* @template T
148+
* @extends {Set<T>}
149+
*/
150+
class SortableSet extends Set {
151+
// ...
152+
}
153+
154+
export default {
155+
sum,
156+
specialTypeObject1,
157+
ab,
158+
ps,
159+
pendingIdleTasks,
160+
string,
161+
sb1,
162+
sb2,
163+
ns,
164+
nds,
165+
nas,
166+
var9,
167+
stringToNumber,
168+
arrayLike,
169+
sbn,
170+
sbn2,
171+
fn7,
172+
star,
173+
question,
174+
typeAssertedNumber,
175+
sbn3,
176+
JSDocState,
177+
stringsStringStrings,
178+
MyClass,
179+
SortableSet,
180+
};

0 commit comments

Comments
 (0)