Skip to content

Commit ae53963

Browse files
committedOct 14, 2018
style: use @nuxtjs/eslint-config
1 parent e480507 commit ae53963

File tree

4 files changed

+30
-44
lines changed

4 files changed

+30
-44
lines changed
 

‎.eslintrc.js

+4-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
11
module.exports = {
22
root: true,
33
parserOptions: {
4+
parser: 'babel-eslint',
45
sourceType: 'module'
56
},
6-
env: {
7-
browser: true,
8-
node: true,
9-
jest: true
10-
},
11-
extends: 'standard',
12-
plugins: ['jest'],
13-
rules: {
14-
// Allow paren-less arrow functions
15-
'arrow-parens': 0,
16-
// Allow async-await
17-
'generator-star-spacing': 0,
18-
// Allow debugger during development
19-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
20-
// Do not allow console.logs etc...
21-
'no-console': 2
22-
},
23-
globals: {
24-
'jest/globals': true,
25-
jasmine: true
26-
}
7+
extends: [
8+
'@nuxtjs'
9+
]
2710
}

‎package.json

+19-16
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"jsdelivr": "dist/vue-next-level-scroll.min.js",
1919
"scripts": {
2020
"dev": "nuxt test/fixture",
21-
"lint": "eslint lib test",
21+
"lint": "eslint src test",
2222
"test": "npm run lint && jest",
2323
"build": "bili --format cjs,es,umd,umd-min --moduleName nextLevelScroll --no-babel.babelrc",
2424
"release": "npm run build && standard-version && git push --follow-tags && npm publish",
@@ -64,37 +64,40 @@
6464
]
6565
},
6666
"devDependencies": {
67-
"@commitlint/cli": "^7.0.0",
68-
"@commitlint/config-conventional": "^7.0.1",
67+
"@commitlint/cli": "^7.2.1",
68+
"@commitlint/config-conventional": "^7.1.2",
69+
"@nuxtjs/eslint-config": "0.0.1",
6970
"@vue/server-test-utils": "^1.0.0-beta.15",
7071
"@vue/test-utils": "^1.0.0-beta.15",
7172
"babel-core": "^6.26.0",
72-
"babel-jest": "^23.0.1",
73-
"babel-loader": "^7.1.2",
73+
"babel-eslint": "^10.0.1",
74+
"babel-jest": "^23.6.0",
75+
"babel-loader": "^8.0.4",
7476
"babel-preset-vue-app": "^2.0.0",
7577
"bili": "^3.1.2",
7678
"cheerio": "^1.0.0-rc.2",
7779
"codecov": "latest",
78-
"cross-env": "^5.1.6",
79-
"eslint": "^4.19.1",
80+
"cross-env": "^5.2.0",
81+
"eslint": "^5.7.0",
8082
"eslint-config-standard": "^12.0.0-alpha.0",
81-
"eslint-plugin-import": "^2.12.0",
83+
"eslint-plugin-import": "^2.14.0",
8284
"eslint-plugin-jest": "latest",
83-
"eslint-plugin-node": "^6.0.1",
84-
"eslint-plugin-promise": "^3.8.0",
85-
"eslint-plugin-standard": "^3.1.0",
85+
"eslint-plugin-node": "^7.0.1",
86+
"eslint-plugin-promise": "^4.0.1",
87+
"eslint-plugin-standard": "^4.0.0",
88+
"eslint-plugin-vue": "^4.7.1",
8689
"flush-promises": "^1.0.0",
87-
"husky": "^1.0.0-rc.2",
90+
"husky": "^1.1.2",
8891
"jest": "latest",
89-
"jest-serializer-vue": "^2.0.0",
92+
"jest-serializer-vue": "^2.0.2",
9093
"jsdom": "latest",
9194
"standard-version": "latest",
9295
"vue-jest": "^2.6.0",
93-
"vue-loader": "^15.2.4",
96+
"vue-loader": "^15.4.2",
9497
"vue-server-renderer": "^2.5.17-beta.0",
9598
"vue-template-compiler": "^2.5.17-beta.0",
96-
"webpack": "^4.10.2",
97-
"webpack-dev-server": "^3.1.4"
99+
"webpack": "^4.20.2",
100+
"webpack-dev-server": "^3.1.9"
98101
},
99102
"dependencies": {
100103
"vue": "^2.5.17-beta.0"

‎src/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default {
22
functional: true,
3-
render (h, { children, data, props: { target, scrollFunction }, _ssrNode }) {
3+
render(h, { children, data, props: { target, scrollFunction }, _ssrNode }) {
44
const clickFunction = () => { scrollFunction ? scrollFunction(target) : defaultScrollFunction(target) }
55

66
return h('div', {
@@ -13,7 +13,7 @@ export default {
1313
}
1414
}
1515

16-
const defaultScrollFunction = async rawTarget => {
16+
const defaultScrollFunction = async (rawTarget) => {
1717
const target = (typeof rawTarget === 'function') ? await rawTarget() : rawTarget
1818

1919
// If no target given, auto scroll to top
@@ -28,7 +28,7 @@ const defaultScrollFunction = async rawTarget => {
2828

2929
// If target prop is present but the node does not exist, send an error
3030
if (!node) {
31-
// eslint-disable-next-line no-console
31+
// eslint-disable-next-line no-console
3232
return console.error(`Could not scroll to ${target}`)
3333
}
3434

‎test/ScrollNextLevel.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable no-console */
22
import { mount } from '@vue/test-utils'
3-
import ScrollNextLevel from '../src'
4-
import Target from './fixtures/Target'
53
import { render } from '@vue/server-test-utils'
64
import flushPromises from 'flush-promises'
5+
import ScrollNextLevel from '../src'
6+
import Target from './fixtures/Target'
77

88
const targetString = '#target'
99

@@ -45,7 +45,7 @@ describe('ScrollNextLevel', () => {
4545
})
4646
})
4747

48-
it('does smooth scroll to target when present', async () => {
48+
it('does smooth scroll to target when present', () => {
4949
spy = jest.spyOn(Element.prototype, 'scrollIntoView')
5050

5151
const wrapper = mount(ScrollNextLevel, {
@@ -182,7 +182,7 @@ describe('ScrollNextLevel', () => {
182182
})
183183

184184
describe('SSR', () => {
185-
it('does nothing on server-side', done => {
185+
it('does nothing on server-side', (done) => {
186186
try {
187187
render(ScrollNextLevel, {
188188
context: {

0 commit comments

Comments
 (0)
Please sign in to comment.