fix: lint & tests

This commit is contained in:
Julien Fontanet 2018-02-07 14:43:14 +01:00
parent 1baf8cfaa6
commit 2da04c5bb1
20 changed files with 22 additions and 20 deletions

View File

@ -9,8 +9,6 @@ module.exports = {
'no-var': 'error',
'node/no-extraneous-import': 'error',
'node/no-extraneous-require': 'error',
'node/no-missing-import': 'error',
'node/no-missing-require': 'error',
'prefer-const': 'error',
},
}

View File

@ -24,10 +24,12 @@
},
"jest": {
"collectCoverage": true,
"projects": ["<rootDir>", "<rootDir>/packages/xo-web"],
"testEnvironment": "node",
"testPathIgnorePatterns": [
"/dist/",
"/xo-vmdk-to-vhd/"
"/xo-vmdk-to-vhd/",
"/xo-web/"
],
"testRegex": "\\.spec\\.js$",
"transform": {

View File

@ -1,7 +1,7 @@
const { createReadStream, createWriteStream, statSync } = require('fs')
const { PassThrough } = require('stream')
const { isOpaqueRef } = require('../') // eslint-disable-line node/no-missing-require
const { isOpaqueRef } = require('../')
exports.createInputStream = path => {
if (path === undefined || path === '-') {

View File

@ -66,7 +66,6 @@
"plot": "gnuplot -p memory-test.gnu",
"prebuild": "rimraf dist/",
"predev": "yarn run prebuild",
"prepare": "yarn run build",
"prepublishOnly": "yarn run build"
},
"babel": {

View File

@ -30,7 +30,6 @@
"scripts": {
"build": "babel --source-maps --out-dir=dist/ src/",
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
"prepare": "yarn run build",
"prepublishOnly": "yarn run build"
}
}

View File

@ -27,9 +27,6 @@ const startsWith = require('lodash/startsWith')
const prettyMs = require('pretty-ms')
const progressStream = require('progress-stream')
const pw = require('pw')
// FIXME: re-enable the rule when https://github.com/mysticatea/eslint-plugin-node/issues/100 is fixed
// eslint-disable-next-line node/no-missing-require
const Xo = require('xo-lib').default
// -------------------------------------------------------------------

View File

@ -1 +1 @@
module.exports = require('./dist/index') // eslint-disable-line node/no-missing-require
module.exports = require('./dist/index')

View File

@ -1 +1 @@
module.exports = require('./dist/unique-index') // eslint-disable-line node/no-missing-require
module.exports = require('./dist/unique-index')

View File

@ -1 +1 @@
module.exports = require('./dist/view') // eslint-disable-line node/no-missing-require
module.exports = require('./dist/view')

View File

@ -1 +1 @@
module.exports = require('./dist/api-errors') // eslint-disable-line node/no-missing-require
module.exports = require('./dist/api-errors')

View File

@ -4,7 +4,7 @@ process.on('unhandledRejection', function (error) {
console.log(error)
})
const Xo = require('./').default // eslint-disable-line node/no-missing-require
const Xo = require('./').default
const xo = new Xo({
url: 'localhost:9000',

View File

@ -40,7 +40,6 @@
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"prebuild": "rimraf dist/",
"predev": "yarn run prebuild",
"prepare": "yarn run build",
"prepublishOnly": "yarn run build"
},
"babel": {

View File

@ -8,4 +8,4 @@ if (process.env.DEBUG === undefined) {
}
// Import the real main module.
module.exports = require('./dist').default // eslint-disable-line node/no-missing-require
module.exports = require('./dist').default

View File

@ -44,7 +44,7 @@ import {
pSettle,
} from '../utils'
import mixins from './mixins' // eslint-disable-line node/no-missing-import
import mixins from './mixins'
import OTHER_CONFIG_TEMPLATE from './other-config-template'
import {
asBoolean,

View File

@ -10,7 +10,7 @@ import {
mapValues,
} from 'lodash'
import * as methods from '../api' // eslint-disable-line node/no-missing-import
import * as methods from '../api'
import {
MethodNotFound,
} from 'json-rpc-peer'

View File

@ -14,7 +14,7 @@ import {
stubTrue,
} from 'lodash'
import mixins from './xo-mixins' // eslint-disable-line node/no-missing-import
import mixins from './xo-mixins'
import Connection from './connection'
import {
mixin,

View File

@ -45,7 +45,6 @@
"dev-test": "mocha --watch --reporter=min \"dist/**/*.spec.js\"",
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepare": "yarn run build",
"prepublishOnly": "yarn run build",
"test-disabled": "mocha \"dist/**/*.spec.js\""
},

View File

@ -124,6 +124,7 @@
"redux": "^3.7.2",
"redux-thunk": "^2.0.1",
"reselect": "^2.5.4",
"rimraf": "^2.6.2",
"semver": "^5.4.1",
"styled-components": "^3.1.5",
"tar-stream": "^1.5.5",
@ -188,5 +189,11 @@
"react",
"stage-0"
]
},
"jest": {
"setupTestFrameworkScriptFile": "./setup-tests.js",
"snapshotSerializers": [
"enzyme-to-json/serializer"
]
}
}

View File

@ -10,6 +10,7 @@ import Upgrade from 'xoa-upgrade'
import { addSubscriptions, connectStore } from 'utils'
import { Container, Row, Col } from 'grid'
import { createGetObjectsOfType, createSelector } from 'selectors'
// eslint-disable-next-line node/no-extraneous-import
import { formatIps, getNextIpV4, parseIpPattern } from 'ip'
import { injectIntl } from 'react-intl'
import { Input as DebounceInput } from 'debounce-input-decorator'

View File

@ -9,6 +9,7 @@ import SortedTable from 'sorted-table'
import StateButton from 'state-button'
import TabButton from 'tab-button'
import Tooltip from 'tooltip'
// eslint-disable-next-line node/no-extraneous-import
import { isIp, isIpV4 } from 'ip'
import { Container, Row, Col } from 'grid'
import { injectIntl } from 'react-intl'