diff --git a/.eslint/index.js b/.eslint/index.js index a9a8f1ebea..1f3d580dcb 100644 --- a/.eslint/index.js +++ b/.eslint/index.js @@ -1,7 +1,10 @@ +const eqeqeqRule = require('./eqeqeq-rule'); +const noExtraParensRule = require('./no-extra-parens-rule'); + module.exports = { rules: { - eqeqeq: require('./eqeqeq-rule'), - 'no-extra-parens': require('./no-extra-parens-rule'), + eqeqeq: eqeqeqRule, + 'no-extra-parens': noExtraParensRule, }, configs: { recommended: { diff --git a/.eslintrc.js b/.eslintrc.js index 056195208a..133dcb1a60 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -113,7 +113,6 @@ module.exports = { // TODO rules with a lot of errors to be fixed manually, fix in a separate PR eqeqeq: 'off', // about 20 errors to be fixed manually - 'global-require': 'off', // about 30 errors to be fixed manually 'no-shadow': 'off', // about 220 errors to be fixed manually 'prefer-arrow-callback': 'off', // about 350 errors (all autofixable) }, diff --git a/gulpfile.js b/gulpfile.js index b15ec062e6..372b1ffc42 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,7 +6,10 @@ const gulp = require('gulp'), // read user config to know what task to load - config = require('./tasks/config/user') + config = require('./tasks/config/user'), + + admin = require('./tasks/collections/admin'), + rtl = require('./tasks/collections/rtl') ; /******************************* @@ -30,10 +33,10 @@ require('./tasks/collections/docs')(gulp); --------------- */ if (config.rtl) { - require('./tasks/collections/rtl')(gulp); + rtl(gulp); } /* Admin Tasks */ if (config.admin) { - require('./tasks/collections/admin')(gulp); + admin(gulp); } diff --git a/tasks/admin/components/init.js b/tasks/admin/components/init.js index ecfd8f7765..a2f02616bf 100644 --- a/tasks/admin/components/init.js +++ b/tasks/admin/components/init.js @@ -24,7 +24,6 @@ const mkdirp = require('mkdirp'), // admin files - github = require('../../config/admin/github'), release = require('../../config/admin/release'), project = require('../../config/project/release'), @@ -38,6 +37,8 @@ const ; module.exports = function (callback) { + const github = require('../../config/admin/github'); // eslint-disable-line global-require + let index = -1, total = release.components.length, diff --git a/tasks/admin/components/update.js b/tasks/admin/components/update.js index ab949b5130..9a8342c603 100644 --- a/tasks/admin/components/update.js +++ b/tasks/admin/components/update.js @@ -22,7 +22,6 @@ const git = require('gulp-git'), // admin files - github = require('../../config/admin/github'), release = require('../../config/admin/release'), project = require('../../config/project/release'), @@ -36,6 +35,8 @@ const ; module.exports = function (callback) { + const github = require('../../config/admin/github'); // eslint-disable-line global-require + let index = -1, total = release.components.length, @@ -73,7 +74,7 @@ module.exports = function (callback) { : '', componentPackage = fs.existsSync(outputDirectory + 'package.json') - ? require(outputDirectory + 'package.json') // eslint-disable-line import/no-dynamic-require + ? require(outputDirectory + 'package.json') // eslint-disable-line global-require, import/no-dynamic-require : false, isNewVersion = version && componentPackage.version !== version, diff --git a/tasks/admin/distributions/init.js b/tasks/admin/distributions/init.js index d14a420f7a..1ee1a576fa 100644 --- a/tasks/admin/distributions/init.js +++ b/tasks/admin/distributions/init.js @@ -24,7 +24,6 @@ const mkdirp = require('mkdirp'), // admin files - github = require('../../config/admin/github'), release = require('../../config/admin/release'), project = require('../../config/project/release'), @@ -38,6 +37,8 @@ const ; module.exports = function (callback) { + const github = require('../../config/admin/github'); // eslint-disable-line global-require + let index = -1, total = release.distributions.length, diff --git a/tasks/admin/distributions/update.js b/tasks/admin/distributions/update.js index 7a56f5af66..9c544db2fa 100644 --- a/tasks/admin/distributions/update.js +++ b/tasks/admin/distributions/update.js @@ -22,7 +22,6 @@ const git = require('gulp-git'), // admin files - github = require('../../config/admin/github'), release = require('../../config/admin/release'), project = require('../../config/project/release'), @@ -36,6 +35,8 @@ const ; module.exports = function (callback) { + const github = require('../../config/admin/github'); // eslint-disable-line global-require + let index = -1, total = release.distributions.length, @@ -69,7 +70,7 @@ module.exports = function (callback) { : '', distributionPackage = fs.existsSync(outputDirectory + 'package.json') - ? require(outputDirectory + 'package.json') // eslint-disable-line import/no-dynamic-require + ? require(outputDirectory + 'package.json') // eslint-disable-line global-require, import/no-dynamic-require : false, isNewVersion = version && distributionPackage.version !== version, diff --git a/tasks/collections/admin.js b/tasks/collections/admin.js index da32d57829..f0527df03b 100644 --- a/tasks/collections/admin.js +++ b/tasks/collections/admin.js @@ -2,6 +2,22 @@ * Admin Task Collection *******************************/ +const + // less/css distributions + initComponents = require('../admin/components/init'), + createComponents = require('../admin/components/create'), + updateComponents = require('../admin/components/update'), + + // single component releases + initDistributions = require('../admin/distributions/init'), + createDistributions = require('../admin/distributions/create'), + updateDistributions = require('../admin/distributions/update'), + + release = require('../admin/release'), + publish = require('../admin/publish'), + register = require('../admin/register') +; + /* This are tasks to be run by project maintainers - Creating Component Repos @@ -14,22 +30,6 @@ *******************************/ module.exports = function (gulp) { - const - // less/css distributions - initComponents = require('../admin/components/init'), - createComponents = require('../admin/components/create'), - updateComponents = require('../admin/components/update'), - - // single component releases - initDistributions = require('../admin/distributions/init'), - createDistributions = require('../admin/distributions/create'), - updateDistributions = require('../admin/distributions/update'), - - release = require('../admin/release'), - publish = require('../admin/publish'), - register = require('../admin/register') - ; - /* Release */ gulp.task('init distributions', initDistributions); gulp.task('init distributions').description = 'Grabs each component from GitHub'; diff --git a/tasks/collections/build.js b/tasks/collections/build.js index 26c504a169..96c03b225f 100644 --- a/tasks/collections/build.js +++ b/tasks/collections/build.js @@ -2,17 +2,16 @@ * Define Build Sub-Tasks *******************************/ -module.exports = function (gulp) { - // build sub-tasks - const - watch = require('../watch'), +const watch = require('../watch'), - build = require('../build'), - buildJS = require('../build/javascript'), - buildCSS = require('../build/css'), - buildAssets = require('../build/assets') - ; + // build sub-tasks + build = require('../build'), + buildJS = require('../build/javascript'), + buildCSS = require('../build/css'), + buildAssets = require('../build/assets') +; +module.exports = function (gulp) { gulp.task('watch', watch); gulp.task('watch').description = 'Watch for site/theme changes'; diff --git a/tasks/collections/docs.js b/tasks/collections/docs.js index 0516c58324..f676673c12 100644 --- a/tasks/collections/docs.js +++ b/tasks/collections/docs.js @@ -2,17 +2,16 @@ * Define Docs Sub-Tasks *******************************/ +// docs tasks +const buildDocs = require('../docs/build'), + serveDocs = require('../docs/serve') +; + /* Lets you serve files to a local documentation instance https://github.com/fomantic/Fomantic-UI-Docs/ */ module.exports = function (gulp) { - let - // docs tasks - serveDocs = require('../docs/serve'), - buildDocs = require('../docs/build') - ; - gulp.task('serve-docs', serveDocs); gulp.task('serve-docs').description = 'Serve file changes to SUI Docs'; diff --git a/tasks/collections/install.js b/tasks/collections/install.js index b51e050782..71f1b9cbcc 100644 --- a/tasks/collections/install.js +++ b/tasks/collections/install.js @@ -2,17 +2,16 @@ * Define Install Sub-Tasks *******************************/ +// docs tasks +const install = require('../install'), + checkInstall = require('../check-install') +; + /* Lets you serve files to a local documentation instance https://github.com/fomantic/Fomantic-UI-Docs/ */ module.exports = function (gulp) { - let - // docs tasks - install = require('../install'), - checkInstall = require('../check-install') - ; - gulp.task('install', install); gulp.task('install').description = 'Runs set-up'; diff --git a/tasks/collections/rtl.js b/tasks/collections/rtl.js index e30762db31..8264711a39 100644 --- a/tasks/collections/rtl.js +++ b/tasks/collections/rtl.js @@ -2,13 +2,11 @@ * Define RTL Sub-Tasks *******************************/ -module.exports = function (gulp) { - // rtl - const - buildRTL = require('../rtl/build'), - watchRTL = require('../rtl/watch') - ; +const buildRTL = require('../rtl/build'), + watchRTL = require('../rtl/watch') +; +module.exports = function (gulp) { gulp.task('watch-rtl', watchRTL); gulp.task('watch-rtl').description = 'DEPRECATED - use \'watch\' instead - Watch files as RTL'; diff --git a/tasks/collections/various.js b/tasks/collections/various.js index da5e8ea68f..192e9e9126 100644 --- a/tasks/collections/various.js +++ b/tasks/collections/various.js @@ -2,16 +2,15 @@ * Define Various Sub-Tasks *******************************/ +const clean = require('../clean'), + version = require('../version') +; + /* Lets you serve files to a local documentation instance https://github.com/fomantic/Fomantic-UI-Docs/ */ module.exports = function (gulp) { - let - clean = require('../clean'), - version = require('../version') - ; - gulp.task('clean', clean); gulp.task('clean').description = 'Clean dist folder'; diff --git a/tasks/config/npm/gulpfile.js b/tasks/config/npm/gulpfile.js index a33fd99f1c..cc45354a31 100644 --- a/tasks/config/npm/gulpfile.js +++ b/tasks/config/npm/gulpfile.js @@ -6,7 +6,9 @@ const gulp = require('gulp'), // read user config to know what task to load - config = require('./tasks/config/user') // eslint-disable-line import/extensions + config = require('./tasks/config/user'), // eslint-disable-line import/extensions + + rtl = require('./tasks/collections/rtl') // eslint-disable-line import/extensions ; /******************************* @@ -30,5 +32,5 @@ require('./tasks/collections/docs')(gulp); // eslint-disable-line import/extensi --------------- */ if (config.rtl) { - require('./tasks/collections/rtl')(gulp); // eslint-disable-line import/extensions + rtl(gulp); } diff --git a/tasks/config/project/release.js b/tasks/config/project/release.js index 990c3b26f3..8981ffd229 100644 --- a/tasks/config/project/release.js +++ b/tasks/config/project/release.js @@ -17,7 +17,7 @@ let config = requireDotFile('semantic.json', process.cwd()); try { - npmPackage = require('../../../package.json'); + npmPackage = require('../../../package.json'); // eslint-disable-line global-require } catch (error) { // generate fake package npmPackage = { diff --git a/tasks/rtl/build.js b/tasks/rtl/build.js index 4d72aea2f5..267b1e9572 100644 --- a/tasks/rtl/build.js +++ b/tasks/rtl/build.js @@ -2,9 +2,11 @@ * Build Task *******************************/ -const gulp = require('gulp'); +const gulp = require('gulp'), + build = require('../build') +; // RTL builds are now handled by the default build process module.exports = function (callback) { - gulp.series(require('../build'))(callback); + gulp.series(build)(callback); }; diff --git a/tasks/rtl/watch.js b/tasks/rtl/watch.js index 1adfffdf99..b67b18800b 100644 --- a/tasks/rtl/watch.js +++ b/tasks/rtl/watch.js @@ -2,9 +2,12 @@ * Watch Task *******************************/ -const gulp = require('gulp'); +const + gulp = require('gulp'), + watch = require('../watch') +; // RTL watch are now handled by the default watch process module.exports = function (callback) { - gulp.series(require('../watch'))(callback); + gulp.series(watch)(callback); };