goldstein 5.12.0 → 5.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -452,7 +452,18 @@ Added useless comma (`,`)? no problem!
|
|
|
452
452
|
const a = {
|
|
453
453
|
- b,,
|
|
454
454
|
+ b,
|
|
455
|
-
}
|
|
455
|
+
};
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Useless semicolon
|
|
459
|
+
|
|
460
|
+
Added useless semicolon (`;`)? no problem!
|
|
461
|
+
|
|
462
|
+
```diff
|
|
463
|
+
const a = {
|
|
464
|
+
- b;
|
|
465
|
+
+ b,
|
|
466
|
+
};
|
|
456
467
|
```
|
|
457
468
|
|
|
458
469
|
## How to contribute?
|
package/package.json
CHANGED
|
@@ -8,7 +8,6 @@ import {parse} from './parser.js';
|
|
|
8
8
|
export {convert} from '../convert/index.js';
|
|
9
9
|
export {print} from '../printer/index.js';
|
|
10
10
|
export * from './parser.js';
|
|
11
|
-
|
|
12
11
|
import * as renameUnnamedIdentifier from '../keyword-useless-comma/rename-unnamed-identifier/index.js';
|
|
13
12
|
|
|
14
13
|
export const compile = (source, options = {}) => {
|
|
@@ -32,4 +31,3 @@ export const compile = (source, options = {}) => {
|
|
|
32
31
|
export const fixEmpty = (source) => {
|
|
33
32
|
return source.replace(/;(\s+)?;/g, ';');
|
|
34
33
|
};
|
|
35
|
-
|
|
@@ -16,6 +16,7 @@ import keywordAddArray from '../keyword-add-array/index.js';
|
|
|
16
16
|
import keywordBrokenString from '../keyword-broken-string/index.js';
|
|
17
17
|
import keywordMissingInitializer from '../keyword-missing-initializer/index.js';
|
|
18
18
|
import keywordUselessComma from '../keyword-useless-comma/index.js';
|
|
19
|
+
import keywordUselessSemicolon from '../keyword-useless-semicolon/index.js';
|
|
19
20
|
|
|
20
21
|
const {values} = Object;
|
|
21
22
|
|
|
@@ -35,6 +36,7 @@ const defaultKeywords = {
|
|
|
35
36
|
stringInterpolation,
|
|
36
37
|
keywordMissingInitializer,
|
|
37
38
|
keywordUselessComma,
|
|
39
|
+
keywordUselessSemicolon,
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
export const keywords = defaultKeywords;
|
|
@@ -18,12 +18,10 @@ export default function fn(Parser) {
|
|
|
18
18
|
if ((node.name === 'class' || node.name === 'function') && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46))
|
|
19
19
|
this.context.pop();
|
|
20
20
|
|
|
21
|
-
this.type = tt.name;
|
|
22
|
-
/* c8 ignore end */
|
|
21
|
+
this.type = tt.name; /* c8 ignore end */
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
return node;
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
27
|
}
|
|
29
|
-
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {tokTypes as tt} from 'acorn';
|
|
2
|
+
|
|
3
|
+
export default function fn(Parser) {
|
|
4
|
+
return class extends Parser {
|
|
5
|
+
parseObj(isPattern, refDestructuringErrors) {
|
|
6
|
+
const node = this.startNode();
|
|
7
|
+
let first = true;
|
|
8
|
+
const propHash = {};
|
|
9
|
+
|
|
10
|
+
node.properties = [];
|
|
11
|
+
this.next();
|
|
12
|
+
|
|
13
|
+
while (!this.eat(tt.braceR)) {
|
|
14
|
+
if (!first) {
|
|
15
|
+
this.eat(tt.comma);
|
|
16
|
+
this.eat(tt.semi);
|
|
17
|
+
|
|
18
|
+
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(tt.braceR))
|
|
19
|
+
break;
|
|
20
|
+
} else {
|
|
21
|
+
first = false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
25
|
+
|
|
26
|
+
if (!isPattern)
|
|
27
|
+
this.checkPropClash(prop, propHash, refDestructuringErrors);
|
|
28
|
+
|
|
29
|
+
node.properties.push(prop);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* c8 ignore start */
|
|
33
|
+
return this.finishNode(node, isPattern ? 'ObjectPattern' : 'ObjectExpression');
|
|
34
|
+
/* c8 ignore end */
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|