Skip to content

Commit

Permalink
feat(chore): use modern "let" instead of "var" in build scripts
Browse files Browse the repository at this point in the history
Modernize code using eslint advisory introduced in GH-2596. This PR focuses on fixing no-var rule.

For src/* files it cannot be fixed (now) because of limited support in IE11.
  • Loading branch information
mvorisek authored Dec 12, 2022
1 parent 6a42d01 commit ae427cc
Show file tree
Hide file tree
Showing 41 changed files with 117 additions and 122 deletions.
12 changes: 6 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ module.exports = {
'prefer-destructuring': 'off',
'prefer-template': 'off',
'spaced-comment': ['error', 'always', {
line: {
markers: ['/'],
exceptions: ['-', '+'],
},
block: {
markers: ['!'],
exceptions: ['*'],
balanced: true,
exceptions: ['*'],
markers: ['!'],
},
line: {
exceptions: ['-', '+'],
markers: ['/'],
},
}],
strict: 'off',
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Set-up
*******************************/

var
let
gulp = require('gulp'),

// read user config to know what task to load
Expand Down
4 changes: 1 addition & 3 deletions tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
These tasks can be imported into your own gulpfile allowing you to avoid using Semantic's build tools

```javascript
var
watch = require('path/to/semantic/tasks/watch')
;
const watch = require('path/to/semantic/tasks/watch');
gulp.task('watch ui', watch);
```
10 changes: 5 additions & 5 deletions tasks/admin/components/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* create meteor.js file
*/

var
let
gulp = require('gulp'),

// node dependencies
Expand All @@ -41,20 +41,20 @@ var
;

module.exports = function (callback) {
var
let
stream,
index,
tasks = []
;

for (index in release.components) {
var
let
component = release.components[index]
;

// streams... designed to save time and make coding fun...
(function (component) {
var
let
outputDirectory = path.join(release.outputRoot, component),
isJavascript = fs.existsSync(output.compressed + component + '.js'),
isCSS = fs.existsSync(output.compressed + component + '.css'),
Expand Down Expand Up @@ -266,7 +266,7 @@ module.exports = function (callback) {

// Creates meteor package.js
function createMeteorPackage() {
var
let
filenames = ''
;

Expand Down
6 changes: 3 additions & 3 deletions tasks/admin/components/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

var
let
gulp = require('gulp'),

// node dependencies
Expand All @@ -38,7 +38,7 @@ var
;

module.exports = function (callback) {
var
let
index = -1,
total = release.components.length,
timer,
Expand All @@ -62,7 +62,7 @@ module.exports = function (callback) {
return;
}

var
let
component = release.components[index],
outputDirectory = path.resolve(release.outputRoot + component),
capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1),
Expand Down
6 changes: 3 additions & 3 deletions tasks/admin/components/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

var
let
gulp = require('gulp'),

// node dependencies
Expand All @@ -36,7 +36,7 @@ var
;

module.exports = function (callback) {
var
let
index = -1,
total = release.components.length,
timer,
Expand All @@ -59,7 +59,7 @@ module.exports = function (callback) {
return;
}

var
let
component = release.components[index],
outputDirectory = path.resolve(path.join(release.outputRoot, component)),
capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1),
Expand Down
20 changes: 10 additions & 10 deletions tasks/admin/distributions/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* update package.json file
*/

var
let
gulp = require('gulp'),

// node dependencies
Expand All @@ -35,20 +35,20 @@ var
;

module.exports = function (callback) {
var
let
stream,
index,
tasks = []
;

for (index in release.distributions) {
var
let
distribution = release.distributions[index]
;

// streams... designed to save time and make coding fun...
(function (distribution) {
var
let
distLowerCase = distribution.toLowerCase(),
outputDirectory = path.join(release.outputRoot, distLowerCase),
packageFile = path.join(outputDirectory, release.files.npm),
Expand Down Expand Up @@ -87,7 +87,7 @@ module.exports = function (callback) {
files = []
;
list.forEach(function (file) {
var
let
isOmitted = (omitted.indexOf(file) > -1),
filePath = path.join(dir, file),
stat = fs.statSync(filePath)
Expand All @@ -106,8 +106,8 @@ module.exports = function (callback) {

// spaces out list correctly
createList = function (files) {
var filenames = '';
for (var file in files) {
let filenames = '';
for (let file in files) {
if (file == (files.length - 1)) {
filenames += "'" + files[file] + "'";
} else {
Expand All @@ -119,7 +119,7 @@ module.exports = function (callback) {
};

tasks.push(function () {
var
let
files = gatherFiles(outputDirectory),
filenames = createList(files)
;
Expand All @@ -135,7 +135,7 @@ module.exports = function (callback) {

if (distribution == 'CSS') {
tasks.push(function () {
var
let
themes,
components,
releases
Expand All @@ -154,7 +154,7 @@ module.exports = function (callback) {
});
} else if (distribution == 'LESS') {
tasks.push(function () {
var
let
definitions,
themeImport,
themeConfig,
Expand Down
6 changes: 3 additions & 3 deletions tasks/admin/distributions/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

var
let
gulp = require('gulp'),

// node dependencies
Expand All @@ -38,7 +38,7 @@ var
;

module.exports = function (callback) {
var
let
index = -1,
total = release.distributions.length,
timer,
Expand All @@ -62,7 +62,7 @@ module.exports = function (callback) {
return;
}

var
let
component = release.distributions[index],
lowerCaseComponent = component.toLowerCase(),
outputDirectory = path.resolve(release.outputRoot + lowerCaseComponent),
Expand Down
6 changes: 3 additions & 3 deletions tasks/admin/distributions/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

var
let
gulp = require('gulp'),

// node dependencies
Expand All @@ -36,7 +36,7 @@ var
;

module.exports = function (callback) {
var
let
index = -1,
total = release.distributions.length,
timer,
Expand All @@ -59,7 +59,7 @@ module.exports = function (callback) {
return;
}

var
let
distribution = release.distributions[index],
outputDirectory = path.resolve(path.join(release.outputRoot, distribution.toLowerCase())),
repoName = release.distRepoRoot + distribution,
Expand Down
2 changes: 1 addition & 1 deletion tasks/admin/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

var
let
gulp = require('gulp')
;

Expand Down
4 changes: 2 additions & 2 deletions tasks/admin/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Registers component with NPM
*/

var
let
// node dependencies
process = require('child_process'),

Expand All @@ -35,7 +35,7 @@ module.exports = function (callback) {

return;
}
var
let
repo = repos[index].toLowerCase(),
outputDirectory = release.outputRoot + repo + '/',
exec = process.exec,
Expand Down
2 changes: 1 addition & 1 deletion tasks/admin/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

var
let
gulp = require('gulp')
;

Expand Down
2 changes: 1 addition & 1 deletion tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Build Task
*******************************/

var
let
// dependencies
gulp = require('gulp'),

Expand Down
4 changes: 2 additions & 2 deletions tasks/build/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Build Task
*******************************/

var
let
gulp = require('gulp'),

// gulp dependencies
Expand Down Expand Up @@ -42,7 +42,7 @@ function buildAssets(src, config, callback) {
}

// copy assets
var assets = () => build(src, config);
let assets = () => build(src, config);
assets.displayName = 'Building Assets';

gulp.series(assets)(callback);
Expand Down
2 changes: 1 addition & 1 deletion tasks/check-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Check Install
*******************************/

var
let
// node dependencies
gulp = require('gulp'),
console = require('better-console'),
Expand Down
2 changes: 1 addition & 1 deletion tasks/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Clean Task
*******************************/

var
let
del = require('del'),
config = require('./config/user'),
tasks = require('./config/tasks')
Expand Down
8 changes: 3 additions & 5 deletions tasks/collections/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ These are collections of tasks that are imported together.

To import them into gulp:
```javascript
var
gulp = require('gulp'),
// modified to point to semantic folder
install = require('tasks/collections/install')
;
const gulp = require('gulp');
// modified to point to semantic folder
const install = require('tasks/collections/install');
gulp = install(gulp);

// tasks are now injected and ready to be used
Expand Down
2 changes: 1 addition & 1 deletion tasks/collections/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*******************************/

module.exports = function (gulp) {
var
let
// less/css distributions
initComponents = require('../admin/components/init'),
createComponents = require('../admin/components/create'),
Expand Down
2 changes: 1 addition & 1 deletion tasks/collections/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
https://github.com/Semantic-Org/Semantic-UI-Docs/
*/
module.exports = function (gulp) {
var
let
// docs tasks
serveDocs = require('../docs/serve'),
buildDocs = require('../docs/build')
Expand Down
2 changes: 1 addition & 1 deletion tasks/collections/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
https://github.com/Semantic-Org/Semantic-UI-Docs/
*/
module.exports = function (gulp) {
var
let
// docs tasks
install = require('../install'),
checkInstall = require('../check-install')
Expand Down
Loading

0 comments on commit ae427cc

Please sign in to comment.