Skip to content

Commit

Permalink
fix #8 Unexpected token error due to class property usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlescure committed Mar 13, 2020
1 parent 3b2e3b1 commit f4715fb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 49 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/runkit.js
15 changes: 1 addition & 14 deletions .neutrinorc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,9 @@ const libName = require('./package.json').name;

module.exports = {
use: [
airbnbBase({
eslint: {
baseConfig: {
rules: {
'jest/no-try-expect': 'off',
},
},
},
}),
airbnbBase(),
library({
name: libName,
babel: {
plugins: [
'@babel/plugin-proposal-class-properties',
],
},
}),
jest(),
(neutrino) => {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"deploy": "yarn build && yarn dist:update && yarn test && yarn dist:commit && yarn publish"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@neutrinojs/airbnb-base": "^9.1.0",
"@neutrinojs/jest": "^9.1.0",
"@neutrinojs/library": "^9.1.0",
Expand Down
31 changes: 17 additions & 14 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ const DICT_RANGES = {
};

class ShortUniqueId {
counter = 0;

debug;

dict = [];

/* eslint-disable consistent-return */
log = (...args) => {
log(...args) {
const finalArgs = [...args];
finalArgs[0] = `[short-unique-id] ${args[0]}`;
/* eslint-disable no-console */
Expand All @@ -26,10 +20,15 @@ class ShortUniqueId {
}
}
/* eslint-enable no-console */
};
}
/* eslint-enable consistent-return */

constructor(options = {}) {
this.counter = 0;
this.debug = false;
this.dict = [];
this.version = version;

const {
dictionary: userDict,
skipShuffle,
Expand Down Expand Up @@ -71,12 +70,14 @@ class ShortUniqueId {
this.log((`Generator instantiated with Dictionary Size ${this.dictLength}`));
}

getDict = () => this.dict;
getDict() {
return this.dict;
}

/**
* Generates UUID based on internal counter that's incremented after each ID generation.
*/
sequentialUUID = () => {
sequentialUUID() {
let counterDiv;
let counterRem;
let id;
Expand All @@ -94,13 +95,13 @@ class ShortUniqueId {
/* eslint-enable no-constant-condition */
this.counter += 1;
return id;
};
}

/**
* Generates UUID by creating each part randomly.
* @param {Integer} uuidLength Desired UUID length.
*/
randomUUID = (uuidLength = DEFAULT_RANDOM_ID_LEN) => {
randomUUID(uuidLength = DEFAULT_RANDOM_ID_LEN) {
let id;
let randomPartIdx;
let j;
Expand Down Expand Up @@ -128,9 +129,11 @@ class ShortUniqueId {

// Return random generated ID.
return id;
};
}

getVersion = () => version;
getVersion() {
return this.version;
}
}

export default ShortUniqueId;
20 changes: 0 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,6 @@
levenary "^1.1.1"
semver "^5.5.0"

"@babel/helper-create-class-features-plugin@^7.8.3":
version "7.8.6"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.8.6.tgz#243a5b46e2f8f0f674dc1387631eb6b28b851de0"
integrity sha512-klTBDdsr+VFFqaDHm5rR69OpEQtO2Qv8ECxHS1mNhJJvaHArR6a1xTf5K/eZW7eZpJbhCx3NW1Yt/sKsLXLblg==
dependencies:
"@babel/helper-function-name" "^7.8.3"
"@babel/helper-member-expression-to-functions" "^7.8.3"
"@babel/helper-optimise-call-expression" "^7.8.3"
"@babel/helper-plugin-utils" "^7.8.3"
"@babel/helper-replace-supers" "^7.8.6"
"@babel/helper-split-export-declaration" "^7.8.3"

"@babel/helper-create-regexp-features-plugin@^7.8.3":
version "7.8.6"
resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.8.6.tgz#7fa040c97fb8aebe1247a5c645330c32d083066b"
Expand Down Expand Up @@ -269,14 +257,6 @@
"@babel/helper-remap-async-to-generator" "^7.8.3"
"@babel/plugin-syntax-async-generators" "^7.8.0"

"@babel/plugin-proposal-class-properties@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.8.3.tgz#5e06654af5cd04b608915aada9b2a6788004464e"
integrity sha512-EqFhbo7IosdgPgZggHaNObkmO1kNUe3slaKu54d5OWvy+p9QIKOzK1GAEpAIsZtWVtPXUHSMcT4smvDrCfY4AA==
dependencies:
"@babel/helper-create-class-features-plugin" "^7.8.3"
"@babel/helper-plugin-utils" "^7.8.3"

"@babel/plugin-proposal-dynamic-import@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.8.3.tgz#38c4fe555744826e97e2ae930b0fb4cc07e66054"
Expand Down

0 comments on commit f4715fb

Please sign in to comment.