Skip to content

Commit b9864c6

Browse files
committed
chore: replace ESLint Standard with AirBnb (#62)
1 parent 7baa52c commit b9864c6

File tree

24 files changed

+268
-226
lines changed

24 files changed

+268
-226
lines changed

.eslintrc.json

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,36 @@
11
{
2-
"extends": "standard",
2+
"extends": [
3+
"airbnb-base"
4+
],
35
"env": {
46
"es6": true,
57
"node": true,
6-
"jest": true
8+
"jest": true,
9+
"cypress/globals": true
10+
},
11+
"plugins": [
12+
"cypress"
13+
],
14+
"settings": {
15+
"import/core-modules": [
16+
"jsdoc/env"
17+
]
18+
},
19+
"rules": {
20+
"no-param-reassign": ["error", {
21+
"props": true,
22+
"ignorePropertyModificationsFor": [
23+
"doclet", // _isVueFile, ...
24+
"e" // for e.doclet
25+
]
26+
}],
27+
"no-underscore-dangle": ["error", {
28+
"allow": [
29+
"_isVueDoc",
30+
"_vueProps",
31+
"_vueData",
32+
"_vueComputed"
33+
]
34+
}]
735
}
8-
}
36+
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const path = require('path')
2-
const extractVueScript = require('../../lib/core/vueScriptExtractor')
1+
const path = require('path');
2+
const extractVueScript = require('../../lib/core/vueScriptExtractor');
33

44
describe('core.extractVueScript', () => {
5-
const filename = path.join(__dirname, '__fixtures__', 'Component.vue')
5+
const filename = path.join(__dirname, '__fixtures__', 'Component.vue');
66

77
test('extract script', () => {
8-
expect(extractVueScript(filename)).toMatchSnapshot()
9-
})
10-
})
8+
expect(extractVueScript(filename)).toMatchSnapshot();
9+
});
10+
});
Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
const guessRenderer = require('../../lib/core/guessRenderer')
1+
/* eslint-disable no-console */
2+
3+
const guessRenderer = require('../../lib/core/guessRenderer');
24

35
describe('guessRenderer', () => {
46
test('guess default', () => {
5-
expect(guessRenderer()).toBe('default')
6-
expect(guessRenderer('default')).toBe('default')
7-
})
7+
expect(guessRenderer()).toBe('default');
8+
expect(guessRenderer('default')).toBe('default');
9+
});
810

911
test('guess docstrap', () => {
10-
expect(guessRenderer('./node_modules/ink-docstrap/template')).toBe('docstrap')
11-
})
12+
expect(guessRenderer('./node_modules/ink-docstrap/template')).toBe('docstrap');
13+
});
1214

1315
test('guess minami', () => {
14-
expect(guessRenderer('node_modules/minami')).toBe('minami')
15-
})
16+
expect(guessRenderer('node_modules/minami')).toBe('minami');
17+
});
1618

1719
test('guess tui', () => {
18-
expect(guessRenderer('node_modules/tui-jsdoc-template')).toBe('tui')
19-
})
20+
expect(guessRenderer('node_modules/tui-jsdoc-template')).toBe('tui');
21+
});
2022

2123
test('guess unsupported', () => {
22-
console.warn = jest.fn()
24+
console.warn = jest.fn();
2325

24-
expect(guessRenderer('foo-bar')).toBe('default')
25-
expect(console.warn).toHaveBeenCalledWith(`The template "foo-bar" is not recognized by jsdoc-vuejs. Using default template as fallback.`)
26-
})
27-
})
26+
expect(guessRenderer('foo-bar')).toBe('default');
27+
expect(console.warn).toHaveBeenCalledWith('The template "foo-bar" is not recognized by jsdoc-vuejs. Using default template as fallback.');
28+
});
29+
});

config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const config = require('jsdoc/env')
2-
const guessRenderer = require('./lib/core/guessRenderer')
1+
const config = require('jsdoc/env');
2+
const guessRenderer = require('./lib/core/guessRenderer');
33

4-
config['jsdoc-vuejs'] = config['jsdoc-vuejs'] || {}
4+
config['jsdoc-vuejs'] = config['jsdoc-vuejs'] || {};
55

66
// Detect JSDoc template if not specified
7-
if (!config['jsdoc-vuejs'].hasOwnProperty('renderer')) {
8-
config['jsdoc-vuejs'].renderer = guessRenderer(config.opts.template || 'default')
7+
if (!Object.prototype.hasOwnProperty.call(config['jsdoc-vuejs'], 'renderer')) {
8+
config['jsdoc-vuejs'].renderer = guessRenderer(config.opts.template || 'default');
99
}
1010

11-
module.exports = config
11+
module.exports = config;
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
describe('Renderers: default', () => {
22
beforeEach(() => {
3-
cy.visit('/../../../example/docs/BetterCounter.html')
4-
})
3+
cy.visit('/../../../example/docs/BetterCounter.html');
4+
});
55

66
it('should renders props correctly', () => {
7-
cy.get('[data-vue="section-props"]').contains('Props')
8-
})
7+
cy.get('[data-vue="section-props"]').contains('Props');
8+
});
99

1010
it('should renders data correctly', () => {
11-
cy.get('[data-vue="section-data"]').contains('Data')
12-
})
11+
cy.get('[data-vue="section-data"]').contains('Data');
12+
});
1313

1414
it('should renders computed correctly', () => {
15-
cy.get('[data-vue="section-computed"]').contains('Computed')
16-
})
17-
})
15+
cy.get('[data-vue="section-computed"]').contains('Computed');
16+
});
17+
});
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
describe('Renderers: docstrap', () => {
22
beforeEach(() => {
3-
cy.visit('/../../../example/docs-docstrap/BetterCounter.html')
4-
})
3+
cy.visit('/../../../example/docs-docstrap/BetterCounter.html');
4+
});
55

66
it('should renders props correctly', () => {
7-
cy.get('[data-vue="section-props"]').contains('Props')
8-
})
7+
cy.get('[data-vue="section-props"]').contains('Props');
8+
});
99

1010
it('should renders data correctly', () => {
11-
cy.get('[data-vue="section-data"]').contains('Data')
12-
})
11+
cy.get('[data-vue="section-data"]').contains('Data');
12+
});
1313

1414
it('should renders computed correctly', () => {
15-
cy.get('[data-vue="section-computed"]').contains('Computed')
16-
})
17-
})
15+
cy.get('[data-vue="section-computed"]').contains('Computed');
16+
});
17+
});
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
describe('Renderers: minami', () => {
22
beforeEach(() => {
3-
cy.visit('/../../../example/docs-minami/BetterCounter.html')
4-
})
3+
cy.visit('/../../../example/docs-minami/BetterCounter.html');
4+
});
55

66
it('should renders props correctly', () => {
7-
cy.get('[data-vue="section-props"]').contains('Props')
8-
})
7+
cy.get('[data-vue="section-props"]').contains('Props');
8+
});
99

1010
it('should renders data correctly', () => {
11-
cy.get('[data-vue="section-data"]').contains('Data')
12-
})
11+
cy.get('[data-vue="section-data"]').contains('Data');
12+
});
1313

1414
it('should renders computed correctly', () => {
15-
cy.get('[data-vue="section-computed"]').contains('Computed')
16-
})
17-
})
15+
cy.get('[data-vue="section-computed"]').contains('Computed');
16+
});
17+
});
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
describe('Renderers: tui', () => {
22
beforeEach(() => {
3-
cy.visit('/../../../example/docs-tui/BetterCounter.html')
4-
})
3+
cy.visit('/../../../example/docs-tui/BetterCounter.html');
4+
});
55

66
it('should renders props correctly', () => {
7-
cy.get('[data-vue="section-props"]').contains('Props')
8-
})
7+
cy.get('[data-vue="section-props"]').contains('Props');
8+
});
99

1010
it('should renders data correctly', () => {
11-
cy.get('[data-vue="section-data"]').contains('Data')
12-
})
11+
cy.get('[data-vue="section-data"]').contains('Data');
12+
});
1313

1414
it('should renders computed correctly', () => {
15-
cy.get('[data-vue="section-computed"]').contains('Computed')
16-
})
17-
})
15+
cy.get('[data-vue="section-computed"]').contains('Computed');
16+
});
17+
});

cypress/plugins/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
// This function is called when a project is opened or re-opened (e.g. due to
1212
// the project's config changing)
1313

14+
// eslint-disable-next-line no-unused-vars
1415
module.exports = (on, config) => {
1516
// `on` is used to hook into various events Cypress emits
1617
// `config` is the resolved Cypress config
17-
}
18+
};

cypress/support/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// ***********************************************************
1515

1616
// Import commands.js using ES2015 syntax:
17-
import './commands'
17+
import './commands';
1818

1919
// Alternatively you can use CommonJS syntax:
2020
// require('./commands')

0 commit comments

Comments
 (0)