mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
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
This commit is contained in:
parent
cd27f30662
commit
e84886aa37
@ -45,7 +45,7 @@ async function read( filename ) {
|
|||||||
// and ensure unix-style path separators
|
// and ensure unix-style path separators
|
||||||
function moduleName( filename ) {
|
function moduleName( filename ) {
|
||||||
return filename
|
return filename
|
||||||
.replace( `${srcFolder}${path.sep}`, "" )
|
.replace( `${ srcFolder }${ path.sep }`, "" )
|
||||||
.replace( /\.js$/, "" )
|
.replace( /\.js$/, "" )
|
||||||
.split( path.sep )
|
.split( path.sep )
|
||||||
.join( path.posix.sep );
|
.join( path.posix.sep );
|
||||||
@ -182,7 +182,7 @@ async function checkExclude( exclude, include ) {
|
|||||||
|
|
||||||
for ( const module of exclude ) {
|
for ( const module of exclude ) {
|
||||||
if ( minimum.indexOf( module ) !== -1 ) {
|
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
|
// 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 "+SHA" if the version is not set.
|
||||||
// Add ".dirty" as well if the working dir is not clean.
|
// 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 } );
|
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 } );
|
await minify( { filename, dir } );
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ async function getCommitHash() {
|
|||||||
function getBranchHeader( branch, commit ) {
|
function getBranchHeader( branch, commit ) {
|
||||||
let branchHeader = branch.trim();
|
let branchHeader = branch.trim();
|
||||||
if ( commit ) {
|
if ( commit ) {
|
||||||
branchHeader = chalk.bold( branchHeader ) + chalk.gray( ` @${commit}` );
|
branchHeader = chalk.bold( branchHeader ) + chalk.gray( ` @${ commit }` );
|
||||||
} else {
|
} else {
|
||||||
branchHeader = chalk.italic( branchHeader );
|
branchHeader = chalk.italic( branchHeader );
|
||||||
}
|
}
|
||||||
@ -65,13 +65,13 @@ function saveCache( loc, cache ) {
|
|||||||
|
|
||||||
function compareSizes( existing, current, padLength ) {
|
function compareSizes( existing, current, padLength ) {
|
||||||
if ( typeof current !== "number" ) {
|
if ( typeof current !== "number" ) {
|
||||||
return chalk.grey( `${existing}`.padStart( padLength ) );
|
return chalk.grey( `${ existing }`.padStart( padLength ) );
|
||||||
}
|
}
|
||||||
const delta = current - existing;
|
const delta = current - existing;
|
||||||
if ( delta > 0 ) {
|
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 ) {
|
function sortBranches( a, b ) {
|
||||||
@ -130,7 +130,7 @@ export async function compareSize( { cache = ".sizecache.json", files } = {} ) {
|
|||||||
const sizes = results.map( function( result ) {
|
const sizes = results.map( function( result ) {
|
||||||
const rawSize = result.raw.toString().padStart( rawPadLength );
|
const rawSize = result.raw.toString().padStart( rawPadLength );
|
||||||
const gzSize = result.gz.toString().padStart( gzPadLength );
|
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 ) {
|
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 compareRaw = compareSizes( branchResult.raw, compareResult.raw, rawPadLength );
|
||||||
const compareGz = compareSizes( branchResult.gz, compareResult.gz, gzPadLength );
|
const compareGz = compareSizes( branchResult.gz, compareResult.gz, gzPadLength );
|
||||||
return `${compareRaw} ${compareGz} ${filename}`;
|
return `${ compareRaw } ${ compareGz } ${ filename }`;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@ -182,7 +182,7 @@ export async function compareSize( { cache = ".sizecache.json", files } = {} ) {
|
|||||||
meta: { commit },
|
meta: { commit },
|
||||||
files: cacheResults( results )
|
files: cacheResults( results )
|
||||||
};
|
};
|
||||||
console.log( `Saved cache for ${branch}.` );
|
console.log( `Saved cache for ${ branch }.` );
|
||||||
}
|
}
|
||||||
|
|
||||||
await saveCache( cache, sizeCache );
|
await saveCache( cache, sizeCache );
|
||||||
|
@ -5,5 +5,5 @@ module.exports = function getTimestamp() {
|
|||||||
const hours = now.getHours().toString().padStart( 2, "0" );
|
const hours = now.getHours().toString().padStart( 2, "0" );
|
||||||
const minutes = now.getMinutes().toString().padStart( 2, "0" );
|
const minutes = now.getMinutes().toString().padStart( 2, "0" );
|
||||||
const seconds = now.getSeconds().toString().padStart( 2, "0" );
|
const seconds = now.getSeconds().toString().padStart( 2, "0" );
|
||||||
return `${hours}:${minutes}:${seconds}`;
|
return `${ hours }:${ minutes }:${ seconds }`;
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ module.exports = async function minify( { dir, filename } ) {
|
|||||||
const filepath = path.join( dir, filename );
|
const filepath = path.join( dir, filename );
|
||||||
const contents = await fs.promises.readFile( filepath, "utf8" );
|
const contents = await fs.promises.readFile( filepath, "utf8" );
|
||||||
const version = /jQuery JavaScript Library ([^\n]+)/.exec( contents )[ 1 ];
|
const version = /jQuery JavaScript Library ([^\n]+)/.exec( contents )[ 1 ];
|
||||||
const banner = `/*! jQuery ${version}` +
|
const banner = `/*! jQuery ${ version }` +
|
||||||
" | (c) OpenJS Foundation and other contributors" +
|
" | (c) OpenJS Foundation and other contributors" +
|
||||||
" | jquery.org/license */";
|
" | jquery.org/license */";
|
||||||
|
|
||||||
@ -79,5 +79,7 @@ module.exports = async function minify( { dir, filename } ) {
|
|||||||
processForDist( code, minFilename );
|
processForDist( code, minFilename );
|
||||||
processForDist( map, mapFilename );
|
processForDist( map, mapFilename );
|
||||||
|
|
||||||
console.log( `[${getTimestamp()}] ${minFilename} ${version} with ${mapFilename} created.` );
|
console.log( `[${ getTimestamp() }] ${ minFilename } ${ version } with ${
|
||||||
|
mapFilename
|
||||||
|
} created.` );
|
||||||
};
|
};
|
||||||
|
@ -21,15 +21,15 @@ async function runTests( { module } ) {
|
|||||||
const testFiles = files.filter( ( testFilePath ) => testFilePath.isFile() );
|
const testFiles = files.filter( ( testFilePath ) => testFilePath.isFile() );
|
||||||
|
|
||||||
if ( !testFiles.length ) {
|
if ( !testFiles.length ) {
|
||||||
throw new Error( `No test files found for "${module}"` );
|
throw new Error( `No test files found for "${ module }"` );
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
testFiles.map( ( testFile ) =>
|
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() {
|
async function runDefaultTests() {
|
||||||
|
@ -35,7 +35,7 @@ async function npmcopy() {
|
|||||||
const toDir = path.dirname( to );
|
const toDir = path.dirname( to );
|
||||||
await fs.promises.mkdir( toDir, { recursive: true } );
|
await fs.promises.mkdir( toDir, { recursive: true } );
|
||||||
await fs.promises.copyFile( from, to );
|
await fs.promises.copyFile( from, to );
|
||||||
console.log( `${source} → ${dest}` );
|
console.log( `${ source } → ${ dest }` );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ if ( !verifyNodeVersion() ) {
|
|||||||
|
|
||||||
const command = path.resolve(
|
const command = path.resolve(
|
||||||
__dirname,
|
__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 args = [ "--reporter", "dot", "--timeout", "2000" ];
|
||||||
const tests = [
|
const tests = [
|
||||||
|
26
package-lock.json
generated
26
package-lock.json
generated
@ -19,8 +19,8 @@
|
|||||||
"commitplease": "3.2.0",
|
"commitplease": "3.2.0",
|
||||||
"concurrently": "8.2.0",
|
"concurrently": "8.2.0",
|
||||||
"core-js-bundle": "3.32.1",
|
"core-js-bundle": "3.32.1",
|
||||||
"eslint": "8.48.0",
|
"eslint": "8.51.0",
|
||||||
"eslint-config-jquery": "3.0.1",
|
"eslint-config-jquery": "3.0.2",
|
||||||
"express": "4.18.2",
|
"express": "4.18.2",
|
||||||
"globals": "13.20.0",
|
"globals": "13.20.0",
|
||||||
"grunt": "1.5.3",
|
"grunt": "1.5.3",
|
||||||
@ -636,9 +636,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/js": {
|
"node_modules/@eslint/js": {
|
||||||
"version": "8.48.0",
|
"version": "8.51.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz",
|
||||||
"integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==",
|
"integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@ -2330,16 +2330,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint": {
|
"node_modules/eslint": {
|
||||||
"version": "8.48.0",
|
"version": "8.51.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz",
|
||||||
"integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==",
|
"integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.6.1",
|
"@eslint-community/regexpp": "^4.6.1",
|
||||||
"@eslint/eslintrc": "^2.1.2",
|
"@eslint/eslintrc": "^2.1.2",
|
||||||
"@eslint/js": "8.48.0",
|
"@eslint/js": "8.51.0",
|
||||||
"@humanwhocodes/config-array": "^0.11.10",
|
"@humanwhocodes/config-array": "^0.11.11",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
"@nodelib/fs.walk": "^1.2.8",
|
"@nodelib/fs.walk": "^1.2.8",
|
||||||
"ajv": "^6.12.4",
|
"ajv": "^6.12.4",
|
||||||
@ -2384,9 +2384,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-config-jquery": {
|
"node_modules/eslint-config-jquery": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-config-jquery/-/eslint-config-jquery-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-config-jquery/-/eslint-config-jquery-3.0.2.tgz",
|
||||||
"integrity": "sha512-YAV9A5rrLdVu6SDaBvqSiqSHPbKCRGoLB1u+gLHnK5Z8GURp4jcdbuWNLdL/fp646vJNLzUeaef95c+Juexq/Q==",
|
"integrity": "sha512-1CdP7AY5ZuhDGUXz+/b7FwhRnDoK0A1swz+2nZ+zpEYJ3EyV085AOAfpFJL2s+ioHDspNQEsGSsl9uUEm9/f/g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/eslint-scope": {
|
"node_modules/eslint-scope": {
|
||||||
|
@ -59,8 +59,8 @@
|
|||||||
"commitplease": "3.2.0",
|
"commitplease": "3.2.0",
|
||||||
"concurrently": "8.2.0",
|
"concurrently": "8.2.0",
|
||||||
"core-js-bundle": "3.32.1",
|
"core-js-bundle": "3.32.1",
|
||||||
"eslint": "8.48.0",
|
"eslint": "8.51.0",
|
||||||
"eslint-config-jquery": "3.0.1",
|
"eslint-config-jquery": "3.0.2",
|
||||||
"express": "4.18.2",
|
"express": "4.18.2",
|
||||||
"globals": "13.20.0",
|
"globals": "13.20.0",
|
||||||
"grunt": "1.5.3",
|
"grunt": "1.5.3",
|
||||||
|
Loading…
Reference in New Issue
Block a user