diff --git a/.eslintrc.js b/.eslintrc.js index be18c172..9e542834 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,12 +1,6 @@ 'use strict'; module.exports = { - env: { - browser: true, - }, - rules: { - 'no-console': 0, - }, extends: [ 'plugin:putout/recommended', ], @@ -15,12 +9,26 @@ module.exports = { 'node', ], overrides: [{ - files: ['server'], + files: ['bin/release.js'], rules: { - 'no-process-exit': 0, + 'no-console': 'off', + 'node/shebang': 'off', }, extends: [ 'plugin:node/recommended', ], + },{ + files: ['bin/cloudcmd.js'], + rules: { + 'no-console': 'off', + }, + extends: [ + 'plugin:node/recommended', + ], + }, { + files: ['{client,common}/**/*.js'], + env: { + browser: true, + }, }], }; diff --git a/client/dom/upload-files.js b/client/dom/upload-files.js index 0b313311..f4f9dc62 100644 --- a/client/dom/upload-files.js +++ b/client/dom/upload-files.js @@ -5,7 +5,6 @@ const {eachSeries} = require('execon'); const wraptile = require('wraptile/legacy'); -const DOM = require('.'); const load = require('./load'); const Images = require('./images'); const {alert} = require('./dialog'); @@ -15,7 +14,7 @@ const {FS} = require('../../common/cloudfunc'); const onEnd = wraptile(_onEnd); const loadFile = wraptile(_loadFile); -const {getCurrentDirPath: getPathWhenRootEmpty} = DOM; +const {getCurrentDirPath: getPathWhenRootEmpty} = require('.'); module.exports = (dir, files) => { if (!files) { diff --git a/common/cloudfunc.spec.js b/common/cloudfunc.spec.js index c72c0a80..217d9ca5 100644 --- a/common/cloudfunc.spec.js +++ b/common/cloudfunc.spec.js @@ -1,8 +1,7 @@ 'use strict'; const test = require('supertape'); -const cloudfunc = require('./cloudfunc'); -const {_getSize} = cloudfunc; +const {_getSize} = require('./cloudfunc'); test('cloudfunc: getSize: dir', (t) => { const type = 'directory'; diff --git a/madrun.js b/madrun.js index e17d6493..d6c23998 100644 --- a/madrun.js +++ b/madrun.js @@ -7,7 +7,6 @@ const { } = require('madrun'); const {version} = require('./package'); -const {eslint} = predefined; const names = [ 'bin/cloudcmd.js', @@ -24,16 +23,19 @@ const names = [ '{client,server,common}/**/*.spec.js', ]; +const {putout} = predefined; + module.exports = { 'start': () => 'node bin/cloudcmd.js', 'start:dev': () => `NODE_ENV=development ${run('start')}`, 'build:start': () => run(['build:client', 'start']), 'build:start:dev': () => run(['build:client:dev', 'start:dev']), 'lint:all': () => run(['lint', 'lint:css', 'spell']), - 'lint': () => eslint({names}), + 'lint': () => putout(names), 'lint:css': () => 'stylelint css/*.css', 'spell': () => 'yaspeller .', - 'fix:lint': () => run('lint', '--fix'), + 'fix:lint': () => run(['lint', 'lint:css'], '--fix'), + 'lint:progress': () => run('lint', '-f progress'), 'test': () => `tape 'test/**/*.js' '{client,static,common,server}/**/*.spec.js'`, 'test:client': () => `tape 'test/client/**/*.js`, 'test:server': () => `tape 'test/**/*.js' 'server/**/*.spec.js' 'common/**/*.spec.js'`, diff --git a/package.json b/package.json index a50b227f..eaa227de 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "lint:css": "madrun lint:css", "spell": "madrun spell", "fix:lint": "madrun fix:lint", + "lint:progress": "madrun lint:progress", "test": "madrun test", "test:client": "madrun test:client", "test:server": "madrun test:server", diff --git a/server/rest/index.spec.js b/server/rest/index.spec.js index 58e215a4..c9d4ff77 100644 --- a/server/rest/index.spec.js +++ b/server/rest/index.spec.js @@ -3,14 +3,13 @@ const test = require('supertape'); const tryToCatch = require('try-to-catch'); -const rest = require('.'); const { _formatMsg, _getWin32RootMsg, _isRootWin32, _isRootAll, _onPUT, -} = rest; +} = require('.'); test('rest: formatMsg', (t) => { const result = _formatMsg('hello', 'world');