Skip to content

Commit 7ce91c8

Browse files
committed
workflow: enable eslint node/no-extraneous-require
1 parent ef2ecf5 commit 7ce91c8

File tree

25 files changed

+68
-36
lines changed

25 files changed

+68
-36
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ template
33
packages/test
44
temp
55
entry-wc.js
6+
dist

.eslintrc

Lines changed: 0 additions & 9 deletions
This file was deleted.

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
extends: [
3+
"plugin:vue-libs/recommended"
4+
],
5+
plugins: [
6+
"node"
7+
],
8+
env: {
9+
"jest": true
10+
},
11+
rules: {
12+
"indent": ["error", 2, {
13+
"MemberExpression": "off"
14+
}],
15+
"node/no-extraneous-require": ["error", {
16+
"allowModules": [
17+
"@vue/cli-test-utils"
18+
]
19+
}]
20+
},
21+
overrides: [
22+
{
23+
files: ['**/__tests__/**/*.js', "**/cli-test-utils/**/*.js"],
24+
rules: {
25+
"node/no-extraneous-require": "off"
26+
}
27+
}
28+
]
29+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"babel-core": "7.0.0-bridge.0",
4646
"debug": "^3.1.0",
4747
"eslint": "^4.16.0",
48+
"eslint-plugin-node": "^6.0.1",
4849
"eslint-plugin-vue-libs": "^2.1.0",
4950
"globby": "^8.0.1",
5051
"http-server": "^0.11.1",

packages/@vue/cli-plugin-e2e-cypress/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
const chalk = require('chalk')
1+
module.exports = (api, options) => {
2+
const { info, chalk, execa } = require('@vue/cli-shared-utils')
23

3-
function removeArg (rawArgs, arg) {
4-
const matchRE = new RegExp(`^--${arg}`)
5-
const equalRE = new RegExp(`^--${arg}=`)
6-
const i = rawArgs.findIndex(arg => matchRE.test(arg))
7-
if (i > -1) {
8-
rawArgs.splice(i, equalRE.test(rawArgs[i]) ? 1 : 2)
9-
}
10-
}
4+
console.log(require('@vue/cli-shared-utils'))
115

12-
module.exports = (api, options) => {
136
api.registerCommand('test:e2e', {
147
description: 'run e2e tests with Cypress',
158
usage: 'vue-cli-service test:e2e [options]',
@@ -27,7 +20,6 @@ module.exports = (api, options) => {
2720
removeArg(rawArgs, 'mode')
2821
removeArg(rawArgs, 'url')
2922

30-
const { info } = require('@vue/cli-shared-utils')
3123
info(`Starting e2e tests...`)
3224

3325
const { url, server } = args.url
@@ -40,7 +32,6 @@ module.exports = (api, options) => {
4032
...rawArgs
4133
]
4234

43-
const execa = require('execa')
4435
const cypressBinPath = require.resolve('cypress/bin/cypress')
4536
const runner = execa(cypressBinPath, cyArgs, { stdio: 'inherit' })
4637
if (server) {
@@ -68,3 +59,12 @@ module.exports = (api, options) => {
6859
module.exports.defaultModes = {
6960
'test:e2e': 'production'
7061
}
62+
63+
function removeArg (rawArgs, arg) {
64+
const matchRE = new RegExp(`^--${arg}`)
65+
const equalRE = new RegExp(`^--${arg}=`)
66+
const i = rawArgs.findIndex(arg => matchRE.test(arg))
67+
if (i > -1) {
68+
rawArgs.splice(i, equalRE.test(rawArgs[i]) ? 1 : 2)
69+
}
70+
}

packages/@vue/cli-plugin-e2e-cypress/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"access": "public"
2323
},
2424
"dependencies": {
25+
"@vue/cli-shared-utils": "^3.0.0-beta.14",
2526
"cypress": "^2.1.0",
2627
"eslint-plugin-cypress": "^2.0.1"
2728
}

packages/@vue/cli-plugin-e2e-nightwatch/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"access": "public"
2323
},
2424
"dependencies": {
25+
"@vue/cli-shared-utils": "^3.0.0-beta.14",
2526
"chromedriver": "^2.38.3",
2627
"deepmerge": "^2.1.0",
2728
"execa": "^0.10.0",

packages/@vue/cli-plugin-eslint/lint.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ const renamedArgs = {
1717

1818
module.exports = function lint (args = {}, api) {
1919
const path = require('path')
20-
const chalk = require('chalk')
2120
const cwd = api.resolve('.')
2221
const { CLIEngine } = require('eslint')
23-
const { log, done, exit } = require('@vue/cli-shared-utils')
22+
const { log, done, exit, chalk } = require('@vue/cli-shared-utils')
2423

2524
const files = args._ && args._.length ? args._ : ['src', 'tests', '*.js']
2625
const extensions = require('./eslintOptions').extensions(api)

packages/@vue/cli-plugin-eslint/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"access": "public"
2323
},
2424
"dependencies": {
25+
"@vue/cli-shared-utils": "^3.0.0-beta.14",
2526
"babel-eslint": "^8.2.3",
2627
"eslint": "^4.19.1",
2728
"eslint-loader": "^2.0.0",

packages/@vue/cli-plugin-eslint/prompts.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// these prompts are used if the plugin is late-installed into an existing
22
// project and invoked by `vue invoke`.
33

4-
const chalk = require('chalk')
5-
const { hasGit } = require('@vue/cli-shared-utils')
4+
const { chalk, hasGit } = require('@vue/cli-shared-utils')
65

76
module.exports = [
87
{

0 commit comments

Comments
 (0)