Skip to content

Commit

Permalink
- chore: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
le0m committed Feb 12, 2020
1 parent ae9a206 commit aa6d8f7
Show file tree
Hide file tree
Showing 14 changed files with 887 additions and 200 deletions.
163 changes: 163 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
extends:
- eslint:recommended

globals:
globalThis: true
assert: true
expect: true
should: true
process: true

env:
es6: true
browser: true
node: true

plugins:
- babel

parser: babel-eslint

parserOptions:
sourceType: module
ecmaFeatures:
jsx: true
generators: false
objectLiteralDuplicateProperties: false

rules:
quotes:
- 1
- single
semi:
- 1
- always
indent:
- 1
- 4
- SwitchCase: 1
func-names: 0
prefer-const: 0
space-before-function-paren:
- 1
- anonymous: never
named: never
asyncArrow: always
no-proto: 0
no-param-reassign: 0
quote-props:
- 1
- consistent-as-needed
radix: 0
no-new-func: 0
arrow-body-style:
- 2
- as-needed
arrow-parens: 0
arrow-spacing:
- 2
- before: true
after: true
comma-dangle:
- 1
- always-multiline
constructor-super: 0
generator-star-spacing: 0
getter-return: 1
no-class-assign: 0
no-confusing-arrow:
- 2
- allowParens: true
no-const-assign: 2
no-new-symbol: 2
no-restricted-globals: 0
no-restricted-imports: 0
no-this-before-super: 0
no-var: 2
no-useless-constructor: 2
object-shorthand:
- 1
- always
prefer-arrow-callback: 2
prefer-spread: 0
prefer-reflect: 0
prefer-rest-params: 2
prefer-template: 1
require-yield: 0
sort-imports: 0
template-curly-spacing: 2
yield-star-spacing:
- 2
- after
max-depth:
- 0
- 4
max-params:
- 0
- 3
max-statements:
- 0
- 10
no-bitwise: 0
no-plusplus: 0
no-unused-vars:
- 1
no-console:
- 1
require-atomic-updates:
- 0

overrides:
- files:
- '*.spec.js'
- '*.spec.jsx'
- '*.spec.ts'
- '*.spec.tsx'
- '*.specs.js'
- '*.specs.jsx'
- '*.specs.ts'
- '*.specs.tsx'
- '*.test.js'
- '*.test.jsx'
- '*.test.ts'
- '*.test.tsx'
- '*.tests.js'
- '*.tests.jsx'
- '*.tests.ts'
- '*.tests.tsx'
- '*.unit.js'
- '*.unit.jsx'
- '*.unit.ts'
- '*.unit.tsx'
- '*.e2e.js'
- '*.e2e.jsx'
- '*.e2e.ts'
- '*.e2e.tsx'
- 'test/**/*.js'
- 'test/**/*.jsx'
- 'test/**/*.ts'
- 'test/**/*.tsx'
- 'tests/**/*.js'
- 'tests/**/*.jsx'
- 'tests/**/*.ts'
- 'tests/**/*.tsx'
- 'unit/**/*.js'
- 'unit/**/*.jsx'
- 'unit/**/*.ts'
- 'unit/**/*.tsx'
- 'e2e/**/*.js'
- 'e2e/**/*.jsx'
- 'e2e/**/*.ts'
- 'e2e/**/*.tsx'
env:
es6: true
browser: true
node: true
mocha: true
plugins:
- babel
- mocha
- mocha-no-only
rules:
mocha-no-only/mocha-no-only:
- 1
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ others this library provides.

### Base

**new Provider(config)**
**new Provider()**

The constructor accepts a configuration object.
The constructor.

**addFile(path, content, encoding)**

Expand All @@ -65,7 +65,7 @@ Accepted encodings are `utf-8` for textual files and `base64` for text represent

Helper method to clear stored files.

**serveFiles(config)**
**serveFiles()**

This method processes the files and serves them depending on the Provider implementation.

Expand Down
4 changes: 2 additions & 2 deletions dist/arjs-studio-backend.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/arjs-studio-backend.min.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,30 @@
"private": false,
"scripts": {
"test": "npx mocha --require esm test",
"build": "webpack --env.production --config webpack.config.js"
"build": "webpack --env.production --config webpack.config.js",
"lint": "eslint --ext .js src/",
"lint:fix": "eslint --fix --ext .js src/"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.5.5",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"chai": "^4.2.0",
"dotenv": "^8.2.0",
"eslint": "^6.8.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-mocha": "^6.2.2",
"eslint-plugin-mocha-no-only": "^1.1.0",
"esm": "^3.2.25",
"mocha": "^6.2.2",
"terser-webpack-plugin": "^2.3.4",
"webpack": "^4.38.0",
"webpack-cli": "^3.3.6"
},
"dependencies": {
"@babel/runtime": "^7.8.4",
"@octokit/rest": "^16.38.2",
"regenerator-runtime": "^0.13.3"
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export {
MarkerModule,
NFTModule,
GithubProvider,
ENC_BASE64
ENC_BASE64,
};
14 changes: 7 additions & 7 deletions src/modules/marker/tools/barcode-marker-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export class BarcodeMarkerGenerator {
constructor(matrixTypeId, value) {
this.typeDesc = BARCODE_MATRIX_TYPES.find(x => x.id === matrixTypeId);
if (!this.typeDesc)
throw new Error('unknown barcode matrix type id: ' + matrixTypeId);
throw new Error(`unknown barcode matrix type id: ${matrixTypeId}`);
if (!Number.isInteger(value))
throw new Error('barcode value is not an integer: ' + value);
throw new Error(`barcode value is not an integer: ${value}`);
if (value < 0 || value >= this.typeDesc.maxNumMarkers)
throw new Error('barcode value out of range: ' + value);
throw new Error(`barcode value out of range: ${value}`);

this.value = value;
this.valueEncoded = this.typeDesc.encoder(value);
Expand All @@ -79,10 +79,10 @@ export class BarcodeMarkerGenerator {

asSVGDataURI() {
return (
'data:image/svg+xml,' +
encodeURIComponent(this.asSVG())
.replace(/'/g, '%27')
.replace(/"/g, '%22')
`data:image/svg+xml,${
encodeURIComponent(this.asSVG())
.replace(/'/g, '%27')
.replace(/"/g, '%22')}`
);
}

Expand Down
Loading

0 comments on commit aa6d8f7

Please sign in to comment.