aboutsummaryrefslogtreecommitdiffstats
path: root/build/tasks
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2023-11-02 00:48:05 +0100
committerGitHub <noreply@github.com>2023-11-02 00:48:05 +0100
commite84886aa37107f35d61b3bde9406c78c13f77cee (patch)
tree3e1d1032de8bb69c5b9be17a93d217de92d608cd /build/tasks
parentcd27f306621d88882df003a9bd32391a3bb95ef3 (diff)
downloadjquery-e84886aa37107f35d61b3bde9406c78c13f77cee.tar.gz
jquery-e84886aa37107f35d61b3bde9406c78c13f77cee.zip
Build: Update ESLint-related packages, fix linting errors (3.x version)
The main change is the new rule in `eslint-config-jquery`: `template-curly-spacing`. Closes gh-5348 Ref jquery/eslint-config-jquery#21 Ref gh-5347
Diffstat (limited to 'build/tasks')
-rw-r--r--build/tasks/build.js8
-rw-r--r--build/tasks/compare_size.mjs14
-rw-r--r--build/tasks/lib/getTimestamp.js2
-rw-r--r--build/tasks/minify.js6
-rw-r--r--build/tasks/node_smoke_tests.js6
-rw-r--r--build/tasks/npmcopy.js2
-rw-r--r--build/tasks/promises_aplus_tests.js2
7 files changed, 21 insertions, 19 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js
index 50f6675c3..e07c26155 100644
--- a/build/tasks/build.js
+++ b/build/tasks/build.js
@@ -45,7 +45,7 @@ async function read( filename ) {
// and ensure unix-style path separators
function moduleName( filename ) {
return filename
- .replace( `${srcFolder}${path.sep}`, "" )
+ .replace( `${ srcFolder }${ path.sep }`, "" )
.replace( /\.js$/, "" )
.split( path.sep )
.join( path.posix.sep );
@@ -182,7 +182,7 @@ async function checkExclude( exclude, include ) {
for ( const module of exclude ) {
if ( minimum.indexOf( module ) !== -1 ) {
- throw new Error( `Module \"${module}\" is a minimum requirement.` );
+ throw new Error( `Module \"${ module }\" is a minimum requirement.` );
}
// Exclude all files in the dir of the same name
@@ -230,7 +230,7 @@ async function build( {
// Add "+SHA" if the version is not set.
// Add ".dirty" as well if the working dir is not clean.
- version = `${pkg.version}+${stdout.trim()}${isClean ? "" : ".dirty"}`;
+ version = `${ pkg.version }+${ stdout.trim() }${ isClean ? "" : ".dirty" }`;
}
await fs.promises.mkdir( dir, { recursive: true } );
@@ -315,7 +315,7 @@ async function build( {
} );
} );
- console.log( `[${getTimestamp()}] ${filename} v${version} created.` );
+ console.log( `[${ getTimestamp() }] ${ filename } v${ version } created.` );
await minify( { filename, dir } );
}
diff --git a/build/tasks/compare_size.mjs b/build/tasks/compare_size.mjs
index c3973bc7a..879a18f93 100644
--- a/build/tasks/compare_size.mjs
+++ b/build/tasks/compare_size.mjs
@@ -24,7 +24,7 @@ async function getCommitHash() {
function getBranchHeader( branch, commit ) {
let branchHeader = branch.trim();
if ( commit ) {
- branchHeader = chalk.bold( branchHeader ) + chalk.gray( ` @${commit}` );
+ branchHeader = chalk.bold( branchHeader ) + chalk.gray( ` @${ commit }` );
} else {
branchHeader = chalk.italic( branchHeader );
}
@@ -65,13 +65,13 @@ function saveCache( loc, cache ) {
function compareSizes( existing, current, padLength ) {
if ( typeof current !== "number" ) {
- return chalk.grey( `${existing}`.padStart( padLength ) );
+ return chalk.grey( `${ existing }`.padStart( padLength ) );
}
const delta = current - existing;
if ( delta > 0 ) {
- return chalk.red( `+${delta}`.padStart( padLength ) );
+ return chalk.red( `+${ delta }`.padStart( padLength ) );
}
- return chalk.green( `${delta}`.padStart( padLength ) );
+ return chalk.green( `${ delta }`.padStart( padLength ) );
}
function sortBranches( a, b ) {
@@ -130,7 +130,7 @@ export async function compareSize( { cache = ".sizecache.json", files } = {} ) {
const sizes = results.map( function( result ) {
const rawSize = result.raw.toString().padStart( rawPadLength );
const gzSize = result.gz.toString().padStart( gzPadLength );
- return `${rawSize} ${gzSize} ${result.filename}`;
+ return `${ rawSize } ${ gzSize } ${ result.filename }`;
} );
const comparisons = Object.keys( sizeCache ).sort( sortBranches ).map( function( branch ) {
@@ -146,7 +146,7 @@ export async function compareSize( { cache = ".sizecache.json", files } = {} ) {
const compareRaw = compareSizes( branchResult.raw, compareResult.raw, rawPadLength );
const compareGz = compareSizes( branchResult.gz, compareResult.gz, gzPadLength );
- return `${compareRaw} ${compareGz} ${filename}`;
+ return `${ compareRaw } ${ compareGz } ${ filename }`;
} );
return [
@@ -182,7 +182,7 @@ export async function compareSize( { cache = ".sizecache.json", files } = {} ) {
meta: { commit },
files: cacheResults( results )
};
- console.log( `Saved cache for ${branch}.` );
+ console.log( `Saved cache for ${ branch }.` );
}
await saveCache( cache, sizeCache );
diff --git a/build/tasks/lib/getTimestamp.js b/build/tasks/lib/getTimestamp.js
index c3c8aed11..4706353c5 100644
--- a/build/tasks/lib/getTimestamp.js
+++ b/build/tasks/lib/getTimestamp.js
@@ -5,5 +5,5 @@ module.exports = function getTimestamp() {
const hours = now.getHours().toString().padStart( 2, "0" );
const minutes = now.getMinutes().toString().padStart( 2, "0" );
const seconds = now.getSeconds().toString().padStart( 2, "0" );
- return `${hours}:${minutes}:${seconds}`;
+ return `${ hours }:${ minutes }:${ seconds }`;
};
diff --git a/build/tasks/minify.js b/build/tasks/minify.js
index edb289cd3..0819246a5 100644
--- a/build/tasks/minify.js
+++ b/build/tasks/minify.js
@@ -12,7 +12,7 @@ module.exports = async function minify( { dir, filename } ) {
const filepath = path.join( dir, filename );
const contents = await fs.promises.readFile( filepath, "utf8" );
const version = /jQuery JavaScript Library ([^\n]+)/.exec( contents )[ 1 ];
- const banner = `/*! jQuery ${version}` +
+ const banner = `/*! jQuery ${ version }` +
" | (c) OpenJS Foundation and other contributors" +
" | jquery.org/license */";
@@ -79,5 +79,7 @@ module.exports = async function minify( { dir, filename } ) {
processForDist( code, minFilename );
processForDist( map, mapFilename );
- console.log( `[${getTimestamp()}] ${minFilename} ${version} with ${mapFilename} created.` );
+ console.log( `[${ getTimestamp() }] ${ minFilename } ${ version } with ${
+ mapFilename
+ } created.` );
};
diff --git a/build/tasks/node_smoke_tests.js b/build/tasks/node_smoke_tests.js
index dd74d180c..01d69eb25 100644
--- a/build/tasks/node_smoke_tests.js
+++ b/build/tasks/node_smoke_tests.js
@@ -21,15 +21,15 @@ async function runTests( { module } ) {
const testFiles = files.filter( ( testFilePath ) => testFilePath.isFile() );
if ( !testFiles.length ) {
- throw new Error( `No test files found for "${module}"` );
+ throw new Error( `No test files found for "${ module }"` );
}
await Promise.all(
testFiles.map( ( testFile ) =>
- exec( `node "${dir}/${testFile.name}" ${module}` )
+ exec( `node "${ dir }/${ testFile.name }" ${ module }` )
)
);
- console.log( `Node smoke tests passed for "${module}".` );
+ console.log( `Node smoke tests passed for "${ module }".` );
}
async function runDefaultTests() {
diff --git a/build/tasks/npmcopy.js b/build/tasks/npmcopy.js
index c57acc2e7..750f26d8a 100644
--- a/build/tasks/npmcopy.js
+++ b/build/tasks/npmcopy.js
@@ -35,7 +35,7 @@ async function npmcopy() {
const toDir = path.dirname( to );
await fs.promises.mkdir( toDir, { recursive: true } );
await fs.promises.copyFile( from, to );
- console.log( `${source} → ${dest}` );
+ console.log( `${ source } → ${ dest }` );
}
}
diff --git a/build/tasks/promises_aplus_tests.js b/build/tasks/promises_aplus_tests.js
index b078e3c5b..931db1b44 100644
--- a/build/tasks/promises_aplus_tests.js
+++ b/build/tasks/promises_aplus_tests.js
@@ -11,7 +11,7 @@ if ( !verifyNodeVersion() ) {
const command = path.resolve(
__dirname,
- `../../node_modules/.bin/promises-aplus-tests${os.platform() === "win32" ? ".cmd" : ""}`
+ `../../node_modules/.bin/promises-aplus-tests${ os.platform() === "win32" ? ".cmd" : "" }`
);
const args = [ "--reporter", "dot", "--timeout", "2000" ];
const tests = [