Skip to content

Commit da0bfdb

Browse files
committed
build: adjust ESLint config for Prettier
1 parent a36720e commit da0bfdb

File tree

4 files changed

+55
-52
lines changed

4 files changed

+55
-52
lines changed

.eslintrc.js

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
module.exports = {
22
root: true,
3-
parser: 'babel-eslint',
3+
parser: "babel-eslint",
44
parserOptions: {
5-
sourceType: 'module'
5+
sourceType: "module"
66
},
7-
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
8-
extends: 'standard',
7+
extends: "prettier",
98
// required to lint *.vue files
10-
plugins: [
11-
'html'
12-
],
9+
plugins: ["html"],
1310
env: {
14-
browser: true,
15-
},
16-
// add your custom rules here
17-
'rules': {
18-
// allow paren-less arrow functions
19-
'arrow-parens': 0,
20-
// allow async-await
21-
'generator-star-spacing': 0,
22-
// allow debugger during development
23-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
24-
// trailing comma
25-
'comma-dangle': ['error', 'always-multiline'],
11+
browser: true
2612
}
27-
}
13+
// add your custom rules here
14+
// 'rules': {
15+
// // allow paren-less arrow functions
16+
// 'arrow-parens': 0,
17+
// // allow async-await
18+
// 'generator-star-spacing': 0,
19+
// // allow debugger during development
20+
// 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
21+
// // trailing comma
22+
// 'comma-dangle': ['error', 'always-multiline'],
23+
// }
24+
};

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"dev": "cross-env NODE_ENV=development webpack --config config/webpack.config.dev.js --progress --watch",
2424
"build": "npm run build:browser && npm run build:common",
2525
"build:browser": "cross-env NODE_ENV=production webpack --config config/webpack.config.browser.js --progress --hide-modules",
26-
"build:common": "cross-env NODE_ENV=production webpack --config config/webpack.config.common.js --progress --hide-modules"
26+
"build:common": "cross-env NODE_ENV=production webpack --config config/webpack.config.common.js --progress --hide-modules",
27+
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
2728
},
2829
"repository": {
2930
"type": "git",
@@ -56,6 +57,7 @@
5657
"cross-spawn": "^5.0.1",
5758
"css-loader": "^0.26.1",
5859
"eslint": "^3.12.1",
60+
"eslint-config-prettier": "^4.1.0",
5961
"eslint-config-standard": "^6.2.1",
6062
"eslint-loader": "^1.6.1",
6163
"eslint-plugin-html": "^1.6.0",

src/components/QrcodeStream.vue

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
</template>
3030

3131
<script>
32-
import { keepScanning } from '../misc/scanner.js'
33-
import { thinSquare } from '../misc/track-func.js'
34-
import Camera from '../misc/camera.js'
35-
import CommonAPI from '../mixins/CommonAPI.vue'
36-
import isEqual from 'lodash/isEqual'
37-
import isBoolean from 'lodash/isBoolean'
38-
import isObject from 'lodash/isObject'
39-
import stubObject from 'lodash/stubObject'
32+
import { keepScanning } from "../misc/scanner.js";
33+
import { thinSquare } from "../misc/track-func.js";
34+
import Camera from "../misc/camera.js";
35+
import CommonAPI from "../mixins/CommonAPI.vue";
36+
import isEqual from "lodash/isEqual";
37+
import isBoolean from "lodash/isBoolean";
38+
import isObject from "lodash/isObject";
39+
import stubObject from "lodash/stubObject";
4040
4141
export default {
4242
mixins: [CommonAPI],
@@ -49,7 +49,7 @@ export default {
4949
5050
camera: {
5151
type: [Object, Boolean],
52-
default: stubObject,
52+
default: stubObject
5353
},
5454
5555
track: {
@@ -63,8 +63,8 @@ export default {
6363
cameraInstance: null,
6464
destroyed: false,
6565
constraints: {},
66-
stopScanning: () => {},
67-
}
66+
stopScanning: () => {}
67+
};
6868
},
6969
7070
computed: {
@@ -73,6 +73,7 @@ export default {
7373
this.paused === false &&
7474
this.destroyed === false &&
7575
this.constraints.video !== false
76+
);
7677
},
7778
7879
shouldScan() {
@@ -99,8 +100,7 @@ export default {
99100
} else {
100101
return this.track;
101102
}
102-
},
103-
103+
}
104104
},
105105
106106
watch: {
@@ -125,36 +125,36 @@ export default {
125125
deep: true,
126126
immediate: true,
127127
128-
handler (camera, oldValue) {
129-
const deeplyEqual = isEqual(camera, oldValue)
128+
handler(camera, oldValue) {
129+
const deeplyEqual = isEqual(camera, oldValue);
130130
131131
if (deeplyEqual) {
132132
// object reference changed but constraints are actually the same
133-
return
133+
return;
134134
} else if (isBoolean(camera)) {
135135
this.constraints = {
136136
audio: false,
137-
video: camera,
138-
}
137+
video: camera
138+
};
139139
} else if (isObject(camera)) {
140140
this.constraints = {
141141
audio: false,
142142
video: {
143-
facingMode: { ideal: 'environment' },
143+
facingMode: { ideal: "environment" },
144144
width: { min: 360, ideal: 640, max: 1920 },
145145
height: { min: 240, ideal: 480, max: 1080 },
146146
147147
// overrides properties above if given
148-
...camera,
149-
},
150-
}
148+
...camera
149+
}
150+
};
151151
}
152-
},
152+
}
153153
},
154154
155-
constraints () {
156-
this.$emit('init', this.init())
157-
},
155+
constraints() {
156+
this.$emit("init", this.init());
157+
}
158158
},
159159
160160
mounted() {
@@ -172,7 +172,7 @@ export default {
172172
this.beforeResetCamera();
173173
174174
if (this.constraints.video === false) {
175-
this.cameraInstance = null
175+
this.cameraInstance = null;
176176
} else {
177177
this.cameraInstance = await Camera(this.constraints, this.$refs.video);
178178
@@ -187,10 +187,8 @@ export default {
187187
188188
startScanning() {
189189
const detectHandler = result => {
190-
this.onDetect(
191-
Promise.resolve({ source: 'stream', ...result })
192-
)
193-
}
190+
this.onDetect(Promise.resolve({ source: "stream", ...result }));
191+
};
194192
195193
// this.stopScanning()
196194
this.stopScanning = keepScanning(this.cameraInstance, {

yarn.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,6 +2460,12 @@ escope@^3.6.0:
24602460
esrecurse "^4.1.0"
24612461
estraverse "^4.1.1"
24622462

2463+
eslint-config-prettier@^4.1.0:
2464+
version "4.1.0"
2465+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.1.0.tgz#181364895899fff9fd3605fecb5c4f20e7d5f395"
2466+
dependencies:
2467+
get-stdin "^6.0.0"
2468+
24632469
eslint-config-standard@^6.2.1:
24642470
version "6.2.1"
24652471
resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-6.2.1.tgz#d3a68aafc7191639e7ee441e7348739026354292"

0 commit comments

Comments
 (0)