]> source.dussan.org Git - jquery.git/commitdiff
Build: Update ESLint-related packages, fix linting errors (3.x version)
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Wed, 1 Nov 2023 23:48:05 +0000 (00:48 +0100)
committerGitHub <noreply@github.com>
Wed, 1 Nov 2023 23:48:05 +0000 (00:48 +0100)
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

build/tasks/build.js
build/tasks/compare_size.mjs
build/tasks/lib/getTimestamp.js
build/tasks/minify.js
build/tasks/node_smoke_tests.js
build/tasks/npmcopy.js
build/tasks/promises_aplus_tests.js
package-lock.json
package.json

index 50f6675c35b3e4b4fc60fcd6b399bcd797ed8ab1..e07c26155f5fe528676b8dbf91cc26cc8e3bc014 100644 (file)
@@ -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 } );
 }
index c3973bc7a1233158730b9e7fdeee508381dba736..879a18f931a5dc6e662f744c1ddcfad4a29bf9fc 100644 (file)
@@ -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 );
index c3c8aed112aa7a2dea9e4b24d5b1e6f6f7798d99..4706353c5b52c23620da8b8b04a2c49cfe79863e 100644 (file)
@@ -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 }`;
 };
index edb289cd337b4b597dff11fcd93af32b7e433499..0819246a57c02c7ab39408e6ac818148d40698b0 100644 (file)
@@ -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.` );
 };
index dd74d180c7238b197d7901844bda3fb9764e5981..01d69eb254bf76be767e6854b1e33fa9dcb62e61 100644 (file)
@@ -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() {
index c57acc2e76546498557f5778d9100972c4df115e..750f26d8a79cc0107d68b51f6a06dfed06eb2582 100644 (file)
@@ -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 }` );
        }
 }
 
index b078e3c5bb5b18d9864e21428f6956795b3e141a..931db1b44fd6b64bafab88f18ec8887372651f72 100644 (file)
@@ -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 = [
index c54b192d8eb7d822e5f6d6434c68f9203fff5656..8d4f77d15786bf47c54c9fac55b22c8a10a453b0 100644 (file)
@@ -19,8 +19,8 @@
         "commitplease": "3.2.0",
         "concurrently": "8.2.0",
         "core-js-bundle": "3.32.1",
-        "eslint": "8.48.0",
-        "eslint-config-jquery": "3.0.1",
+        "eslint": "8.51.0",
+        "eslint-config-jquery": "3.0.2",
         "express": "4.18.2",
         "globals": "13.20.0",
         "grunt": "1.5.3",
       }
     },
     "node_modules/@eslint/js": {
-      "version": "8.48.0",
-      "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz",
-      "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==",
+      "version": "8.51.0",
+      "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz",
+      "integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==",
       "dev": true,
       "engines": {
         "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
       }
     },
     "node_modules/eslint": {
-      "version": "8.48.0",
-      "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz",
-      "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==",
+      "version": "8.51.0",
+      "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz",
+      "integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==",
       "dev": true,
       "dependencies": {
         "@eslint-community/eslint-utils": "^4.2.0",
         "@eslint-community/regexpp": "^4.6.1",
         "@eslint/eslintrc": "^2.1.2",
-        "@eslint/js": "8.48.0",
-        "@humanwhocodes/config-array": "^0.11.10",
+        "@eslint/js": "8.51.0",
+        "@humanwhocodes/config-array": "^0.11.11",
         "@humanwhocodes/module-importer": "^1.0.1",
         "@nodelib/fs.walk": "^1.2.8",
         "ajv": "^6.12.4",
       }
     },
     "node_modules/eslint-config-jquery": {
-      "version": "3.0.1",
-      "resolved": "https://registry.npmjs.org/eslint-config-jquery/-/eslint-config-jquery-3.0.1.tgz",
-      "integrity": "sha512-YAV9A5rrLdVu6SDaBvqSiqSHPbKCRGoLB1u+gLHnK5Z8GURp4jcdbuWNLdL/fp646vJNLzUeaef95c+Juexq/Q==",
+      "version": "3.0.2",
+      "resolved": "https://registry.npmjs.org/eslint-config-jquery/-/eslint-config-jquery-3.0.2.tgz",
+      "integrity": "sha512-1CdP7AY5ZuhDGUXz+/b7FwhRnDoK0A1swz+2nZ+zpEYJ3EyV085AOAfpFJL2s+ioHDspNQEsGSsl9uUEm9/f/g==",
       "dev": true
     },
     "node_modules/eslint-scope": {
index f1ab993a363f4e1df399c39b4a6670398c6f60b8..62f7c10ca38a1fc26bdfdcb101a0589d22712e74 100644 (file)
@@ -59,8 +59,8 @@
     "commitplease": "3.2.0",
     "concurrently": "8.2.0",
     "core-js-bundle": "3.32.1",
-    "eslint": "8.48.0",
-    "eslint-config-jquery": "3.0.1",
+    "eslint": "8.51.0",
+    "eslint-config-jquery": "3.0.2",
     "express": "4.18.2",
     "globals": "13.20.0",
     "grunt": "1.5.3",