From f665a5d98509c7fbcd2ab94f17d6bc5c8134e39c Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 15 Oct 2020 15:39:06 -0400 Subject: [PATCH 01/47] feat: add demo config file --- css-audit.config.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 css-audit.config.js diff --git a/css-audit.config.js b/css-audit.config.js new file mode 100644 index 0000000..7234b4c --- /dev/null +++ b/css-audit.config.js @@ -0,0 +1,28 @@ +module.exports = { + "format": "html", + "filename": "wp-admin", + "audits": [ + "colors", + "important", + "display-none", + "selectors", + "media-queries", + [ + "property-values", + { + "options": [ "font-size" ] + } + ], + [ + "property-values", + { + "options": [ + "padding-top", + "padding-bottom", + "padding-left", + "padding-right" + ] + } + ] + ] +}; From 5cd1145d74291d929a3fa40799ee399f52df01dd Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 15 Oct 2020 16:29:58 -0400 Subject: [PATCH 02/47] feat: kinda working with simplified config --- css-audit.config.js | 22 ++-------------------- src/index.js | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/css-audit.config.js b/css-audit.config.js index 7234b4c..92600ed 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -1,28 +1,10 @@ module.exports = { - "format": "html", - "filename": "wp-admin", + "format": "cli-table", "audits": [ "colors", "important", "display-none", "selectors", - "media-queries", - [ - "property-values", - { - "options": [ "font-size" ] - } - ], - [ - "property-values", - { - "options": [ - "padding-top", - "padding-bottom", - "padding-left", - "padding-right" - ] - } - ] + "media-queries" ] }; diff --git a/src/index.js b/src/index.js index 8d4a733..13bd261 100644 --- a/src/index.js +++ b/src/index.js @@ -9,8 +9,8 @@ const path = require( 'path' ); */ const { formatReport } = require( './utils/format-report' ); const { getArgFromCLI, getFileArgsFromCLI, getHelp } = require( './utils/cli' ); - const input = getFileArgsFromCLI(); + if ( getArgFromCLI( '--help' ) || ! input.length ) { console.log( getHelp() ); // eslint-disable-line no-console process.exit( 0 ); @@ -32,11 +32,23 @@ input.forEach( ( file ) => { } ); } ); +const audits = []; + +const config = require( '../css-audit.config.js' ); +const usingConfig = getArgFromCLI( '--config' ); + +if ( usingConfig ) { + + // TODO: Support value for config arg, and default to css-audit.config filename + config.audits.forEach( audit => { + // TODO: check for and support property-values array + audits.push( require( `./audits/${audit}` )( cssFiles ) ); + }); +} + const runAll = getArgFromCLI( '--all' ); const runRecommended = getArgFromCLI( '--recommended' ); -const audits = []; - if ( runAll || runRecommended || getArgFromCLI( '--colors' ) ) { audits.push( require( './audits/colors' )( cssFiles ) ); } @@ -63,4 +75,7 @@ if ( !! getArgFromCLI( '--property-values' ) ) { const reports = audits.flat().filter( Boolean ); -console.log( formatReport( reports, getArgFromCLI( '--format' ) ) ); // eslint-disable-line no-console +// TODO: This needs more thought +const format = usingConfig ? config.format : getArgFromCLI( '--format' ); + +console.log( formatReport( reports, format ) ); // eslint-disable-line no-console From 9d22899bd1136589016996a20572dfbe56e4ebee Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 15 Oct 2020 16:52:15 -0400 Subject: [PATCH 03/47] refact: abstracting so we can test --- index.js | 11 ++++++ package.json | 2 +- src/index.js | 81 ----------------------------------------- src/run.js | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 112 insertions(+), 82 deletions(-) create mode 100644 index.js delete mode 100644 src/index.js create mode 100644 src/run.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..7fea98f --- /dev/null +++ b/index.js @@ -0,0 +1,11 @@ +const { runAudits } = require( './src/run' ); + +const { getArgFromCLI } = require( './src/utils/cli' ); + +const config = getArgFromCLI( '--config' ) ? require( './css-audit.config' ) : false; + +console.log( config ); + +const result = runAudits( config ); + +console.log( result ); diff --git a/package.json b/package.json index 5e99c39..e74cc7c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "css-audit": "node ./src/index.js", + "css-audit": "node ./index.js", "lint:js": "eslint src", "format:js": "prettier {src,.}/**/*.js --write", "test": "jest" diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 13bd261..0000000 --- a/src/index.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Node dependencies - */ -const fs = require( 'fs' ); -const path = require( 'path' ); - -/** - * Internal dependencies - */ -const { formatReport } = require( './utils/format-report' ); -const { getArgFromCLI, getFileArgsFromCLI, getHelp } = require( './utils/cli' ); -const input = getFileArgsFromCLI(); - -if ( getArgFromCLI( '--help' ) || ! input.length ) { - console.log( getHelp() ); // eslint-disable-line no-console - process.exit( 0 ); -} - -const cssFiles = []; -input.forEach( ( file ) => { - const filePath = path.resolve( process.env.INIT_CWD, file ); - const stats = fs.statSync( filePath ); - if ( stats.isDirectory() ) { - return; - } - if ( file.match( /min\.css$/ ) ) { - return; - } - cssFiles.push( { - name: file, - content: String( fs.readFileSync( filePath ) ), - } ); -} ); - -const audits = []; - -const config = require( '../css-audit.config.js' ); -const usingConfig = getArgFromCLI( '--config' ); - -if ( usingConfig ) { - - // TODO: Support value for config arg, and default to css-audit.config filename - config.audits.forEach( audit => { - // TODO: check for and support property-values array - audits.push( require( `./audits/${audit}` )( cssFiles ) ); - }); -} - -const runAll = getArgFromCLI( '--all' ); -const runRecommended = getArgFromCLI( '--recommended' ); - -if ( runAll || runRecommended || getArgFromCLI( '--colors' ) ) { - audits.push( require( './audits/colors' )( cssFiles ) ); -} -if ( runAll || runRecommended || getArgFromCLI( '--important' ) ) { - audits.push( require( './audits/important' )( cssFiles ) ); -} -if ( runAll || getArgFromCLI( '--display-none' ) ) { - audits.push( require( './audits/display-none' )( cssFiles ) ); -} -if ( runAll || runRecommended || getArgFromCLI( '--selectors' ) ) { - audits.push( require( './audits/selectors' )( cssFiles ) ); -} -if ( runAll || runRecommended || getArgFromCLI( '--media-queries' ) ) { - audits.push( require( './audits/media-queries' )( cssFiles ) ); -} -if ( !! getArgFromCLI( '--property-values' ) ) { - audits.push( - require( './audits/property-values' )( - cssFiles, - getArgFromCLI( '--property-values' ).split( ',' ) - ) - ); -} - -const reports = audits.flat().filter( Boolean ); - -// TODO: This needs more thought -const format = usingConfig ? config.format : getArgFromCLI( '--format' ); - -console.log( formatReport( reports, format ) ); // eslint-disable-line no-console diff --git a/src/run.js b/src/run.js new file mode 100644 index 0000000..d9dadff --- /dev/null +++ b/src/run.js @@ -0,0 +1,100 @@ +/** + * Node dependencies + */ +const fs = require( 'fs' ); +const path = require( 'path' ); + +/** + * Internal dependencies + */ +const { formatReport } = require( './utils/format-report' ); +const { getArgFromCLI, getFileArgsFromCLI, getHelp } = require( './utils/cli' ); + + +const runAuditsFromCLIArgs = ( cssFiles ) => { + const audits = []; + const runAll = getArgFromCLI( '--all' ); + const runRecommended = getArgFromCLI( '--recommended' ); + + if ( runAll || runRecommended || getArgFromCLI( '--colors' ) ) { + audits.push( require( './audits/colors' )( cssFiles ) ); + } + if ( runAll || runRecommended || getArgFromCLI( '--important' ) ) { + audits.push( require( './audits/important' )( cssFiles ) ); + } + if ( runAll || getArgFromCLI( '--display-none' ) ) { + audits.push( require( './audits/display-none' )( cssFiles ) ); + } + if ( runAll || runRecommended || getArgFromCLI( '--selectors' ) ) { + audits.push( require( './audits/selectors' )( cssFiles ) ); + } + if ( runAll || runRecommended || getArgFromCLI( '--media-queries' ) ) { + audits.push( require( './audits/media-queries' )( cssFiles ) ); + } + if ( !! getArgFromCLI( '--property-values' ) ) { + audits.push( + require( './audits/property-values' )( + cssFiles, + getArgFromCLI( '--property-values' ).split( ',' ) + ) + ); + } + + const reports = audits.flat().filter( Boolean ); + + const format = getArgFromCLI( '--format' ); + + return formatReport( reports, format ); + +}; + +const runAuditsFromConfig = ( config, cssFiles ) => { + const audits = []; + + // TODO: Support value for config arg, and default to css-audit.config filename + config.audits.forEach( audit => { + // TODO: check for and support property-values array + audits.push( require( `./audits/${audit}` )( cssFiles ) ); + }); + + const reports = audits.flat().filter( Boolean ); + + const format = config.format; + + return formatReport( reports, format ); +} + +const runAudits = ( config = false ) => { + + const input = getFileArgsFromCLI(); + + if ( getArgFromCLI( '--help' ) || ! input.length ) { + console.log( getHelp() ); // eslint-disable-line no-console + process.exit( 0 ); + } + + const cssFiles = []; + input.forEach( ( file ) => { + const filePath = path.resolve( process.env.INIT_CWD, file ); + const stats = fs.statSync( filePath ); + if ( stats.isDirectory() ) { + return; + } + if ( file.match( /min\.css$/ ) ) { + return; + } + cssFiles.push( { + name: file, + content: String( fs.readFileSync( filePath ) ), + } ); + } ); + + const result = false !== config ? runAuditsFromConfig( config, cssFiles ) : runAuditsFromCLIArgs( cssFiles ); + + return result; + +} + +module.exports = { + runAudits +}; From d006d3deb7cdf10c56b43a7f7eb5b16833a1d879 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 15 Oct 2020 17:02:46 -0400 Subject: [PATCH 04/47] refact: move cli code to index --- index.js | 36 ++++++++++++++++++++++++++++++++---- src/run.js | 37 +++---------------------------------- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/index.js b/index.js index 7fea98f..92b4f7f 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,39 @@ +/** + * Node dependencies + */ +const fs = require( 'fs' ); +const path = require( 'path' ); + +/** + * Internal dependencies + */ const { runAudits } = require( './src/run' ); +const { getArgFromCLI, getFileArgsFromCLI, getHelp } = require( './src/utils/cli' ); -const { getArgFromCLI } = require( './src/utils/cli' ); +const config = require( './css-audit.config' ); +const input = getFileArgsFromCLI(); -const config = getArgFromCLI( '--config' ) ? require( './css-audit.config' ) : false; +if ( getArgFromCLI( '--help' ) || ! input.length ) { + console.log( getHelp() ); // eslint-disable-line no-console + process.exit( 0 ); +} -console.log( config ); +const cssFiles = []; +input.forEach( ( file ) => { + const filePath = path.resolve( process.env.INIT_CWD, file ); + const stats = fs.statSync( filePath ); + if ( stats.isDirectory() ) { + return; + } + if ( file.match( /min\.css$/ ) ) { + return; + } + cssFiles.push( { + name: file, + content: String( fs.readFileSync( filePath ) ), + } ); +} ); -const result = runAudits( config ); +const result = runAudits( config, cssFiles ); console.log( result ); diff --git a/src/run.js b/src/run.js index d9dadff..8d8b0e1 100644 --- a/src/run.js +++ b/src/run.js @@ -1,15 +1,8 @@ -/** - * Node dependencies - */ -const fs = require( 'fs' ); -const path = require( 'path' ); - /** * Internal dependencies */ const { formatReport } = require( './utils/format-report' ); -const { getArgFromCLI, getFileArgsFromCLI, getHelp } = require( './utils/cli' ); - +const { getArgFromCLI } = require( './utils/cli' ); const runAuditsFromCLIArgs = ( cssFiles ) => { const audits = []; @@ -64,35 +57,11 @@ const runAuditsFromConfig = ( config, cssFiles ) => { return formatReport( reports, format ); } -const runAudits = ( config = false ) => { +const runAudits = ( config = false, cssFiles ) => { - const input = getFileArgsFromCLI(); - - if ( getArgFromCLI( '--help' ) || ! input.length ) { - console.log( getHelp() ); // eslint-disable-line no-console - process.exit( 0 ); - } - - const cssFiles = []; - input.forEach( ( file ) => { - const filePath = path.resolve( process.env.INIT_CWD, file ); - const stats = fs.statSync( filePath ); - if ( stats.isDirectory() ) { - return; - } - if ( file.match( /min\.css$/ ) ) { - return; - } - cssFiles.push( { - name: file, - content: String( fs.readFileSync( filePath ) ), - } ); - } ); - - const result = false !== config ? runAuditsFromConfig( config, cssFiles ) : runAuditsFromCLIArgs( cssFiles ); + const result = config ? runAuditsFromConfig( config, cssFiles ) : runAuditsFromCLIArgs( cssFiles ); return result; - } module.exports = { From 49f24246fe1f9fe33f324930917ccec6b2b12718 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 29 Oct 2020 13:30:20 -0700 Subject: [PATCH 05/47] test: add okay test for running audits --- src/__tests__/index.js | 5 ----- src/__tests__/run.js | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) delete mode 100644 src/__tests__/index.js create mode 100644 src/__tests__/run.js diff --git a/src/__tests__/index.js b/src/__tests__/index.js deleted file mode 100644 index 82bf4e7..0000000 --- a/src/__tests__/index.js +++ /dev/null @@ -1,5 +0,0 @@ -describe( 'tests', () => { - it( 'there will be tests', ( done ) => { - done(); - } ); -} ); diff --git a/src/__tests__/run.js b/src/__tests__/run.js new file mode 100644 index 0000000..2d5b0fe --- /dev/null +++ b/src/__tests__/run.js @@ -0,0 +1,26 @@ +const { runAudits } = require( '../run' ); + +describe( 'Run the audits', () => { + it( 'there will be tests', () => { + const config = { + "format": "json", + "audits": [ + "colors", + "important", + "display-none", + "selectors", + "media-queries" + ] + }; + const result = runAudits( config, [ + { + name: 'a.css', + content: `body { font-size: 1em !important; line-height: 1.6; }`, + }, + ] ); + + config.audits.forEach( audit => { + expect( result ).toContain( audit ); + }); + } ); +} ); From 2093185c7655378ffb98ab3a67a8427a0f899029 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 29 Oct 2020 13:30:36 -0700 Subject: [PATCH 06/47] fix: add audit key --- src/__tests__/css/test.css | 3 --- src/audits/media-queries.js | 7 +++++++ 2 files changed, 7 insertions(+), 3 deletions(-) delete mode 100644 src/__tests__/css/test.css diff --git a/src/__tests__/css/test.css b/src/__tests__/css/test.css deleted file mode 100644 index ef402c7..0000000 --- a/src/__tests__/css/test.css +++ /dev/null @@ -1,3 +0,0 @@ -.test { - color: green; -} \ No newline at end of file diff --git a/src/audits/media-queries.js b/src/audits/media-queries.js index a01a303..f5aa019 100644 --- a/src/audits/media-queries.js +++ b/src/audits/media-queries.js @@ -52,36 +52,43 @@ module.exports = function ( files = [] ) { return [ { id: 'count', + audit: 'media-queries', label: 'Number of total media queries', value: allQueries.length, }, { id: 'count-unique-queries', + audit: 'media-queries', label: 'Number of seemingly-unique media queries', value: uniqQueries.length, }, { id: 'top-10-queries', + audit: 'media-queries', label: 'Top 10 most-used media queries', value: queriesByCount.slice( 0, 10 ), }, { id: 'count-unique-sizes', + audit: 'media-queries', label: 'Number of unique breakpoint sizes', value: uniqSizes.length, }, { id: 'top-10-sizes', + audit: 'media-queries', label: 'Top 10 most-used breakpoint sizes', value: sizesByCount.slice( 0, 10 ), }, { id: 'bottom-10-sizes', + audit: 'media-queries', label: 'Top 10 least-used breakpoint sizes', value: sizesByCount.slice( -10 ).reverse(), }, { id: 'non-width', + audit: 'media-queries', label: 'Non-width related media queries', value: nonWidthByCount, }, From 9b63b85aa21674265cc555c85317ad2f86bd580d Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 12 Nov 2020 16:50:33 -0500 Subject: [PATCH 07/47] feat: support property values --- css-audit.config.js | 18 +++++++++++++----- src/__tests__/run.js | 30 +++++++++++++++++++++++++++--- src/audits/property-values.js | 4 ++++ src/run.js | 27 +++++++++++++++++++++------ 4 files changed, 65 insertions(+), 14 deletions(-) diff --git a/css-audit.config.js b/css-audit.config.js index 92600ed..48bb2ef 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -1,10 +1,18 @@ module.exports = { "format": "cli-table", "audits": [ - "colors", - "important", - "display-none", - "selectors", - "media-queries" + [ + "property-values", + [ "font-size" ] + ], + [ + "property-values", + [ + "padding-top", + "padding-bottom", + "padding-left", + "padding-right" + ] + ] ] }; diff --git a/src/__tests__/run.js b/src/__tests__/run.js index 2d5b0fe..f0df9c6 100644 --- a/src/__tests__/run.js +++ b/src/__tests__/run.js @@ -1,7 +1,7 @@ const { runAudits } = require( '../run' ); describe( 'Run the audits', () => { - it( 'there will be tests', () => { + it( 'runs with a configuration object', () => { const config = { "format": "json", "audits": [ @@ -9,7 +9,20 @@ describe( 'Run the audits', () => { "important", "display-none", "selectors", - "media-queries" + "media-queries", + [ + "property-values", + [ "font-size" ] + ], + [ + "property-values", + [ + "padding-top", + "padding-bottom", + "padding-left", + "padding-right" + ] + ] ] }; const result = runAudits( config, [ @@ -20,7 +33,18 @@ describe( 'Run the audits', () => { ] ); config.audits.forEach( audit => { - expect( result ).toContain( audit ); + + if ( Array.isArray( audit ) ) { + + audit[1].forEach( property => { + expect( result ).toContain( property ); + }); + + } else { + + expect( result ).toContain( audit ); + + } }); } ); } ); diff --git a/src/audits/property-values.js b/src/audits/property-values.js index ea51ef1..7a83dd7 100644 --- a/src/audits/property-values.js +++ b/src/audits/property-values.js @@ -34,21 +34,25 @@ module.exports = function ( files = [], properties = [] ) { return [ { id: 'count', + audit: 'property-values', label: `Number of values for ${ properties.join( ', ' ) }`, value: values.length, }, { id: 'count-unique', + audit: 'property-values', label: `Number of unique values for ${ properties.join( ', ' ) }`, value: uniqueValues.length, }, { id: 'top-10-values', + audit: 'property-values', label: `Top 10 most-used values for ${ properties.join( ', ' ) }`, value: valuesByCount.slice( 0, 10 ), }, { id: 'bottom-10-values', + audit: 'property-values', label: `Top 10 least-used values for ${ properties.join( ', ' ) }`, value: valuesByCount.slice( -10 ).reverse(), }, diff --git a/src/run.js b/src/run.js index 8d8b0e1..dd31523 100644 --- a/src/run.js +++ b/src/run.js @@ -33,33 +33,48 @@ const runAuditsFromCLIArgs = ( cssFiles ) => { ); } + console.log(audits); + const reports = audits.flat().filter( Boolean ); const format = getArgFromCLI( '--format' ); + // console.log( reports ); return formatReport( reports, format ); }; const runAuditsFromConfig = ( config, cssFiles ) => { const audits = []; + const { format } = config; // TODO: Support value for config arg, and default to css-audit.config filename config.audits.forEach( audit => { - // TODO: check for and support property-values array - audits.push( require( `./audits/${audit}` )( cssFiles ) ); + + if ( Array.isArray( audit ) ) { + + const [ auditName, auditTerms ] = audit; + + audits.push( + require( `./audits/${auditName}` )( + cssFiles, + auditTerms + ) + ); + } else { + audits.push( require( `./audits/${audit}` )( cssFiles ) ); + } + }); const reports = audits.flat().filter( Boolean ); - const format = config.format; - return formatReport( reports, format ); } -const runAudits = ( config = false, cssFiles ) => { +const runAudits = ( config = {}, cssFiles ) => { - const result = config ? runAuditsFromConfig( config, cssFiles ) : runAuditsFromCLIArgs( cssFiles ); + const result = 0 < Object.keys( config ).length ? runAuditsFromConfig( config, cssFiles ) : runAuditsFromCLIArgs( cssFiles ); return result; } From 8f9447c82028124e910d3de49af801f2cdeab082 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 12 Nov 2020 16:51:11 -0500 Subject: [PATCH 08/47] chore: format js --- src/__tests__/run.js | 48 ++++++++++++++++++-------------------------- src/formats/html.js | 19 ++++++++++++------ src/run.js | 29 +++++++++++--------------- 3 files changed, 45 insertions(+), 51 deletions(-) diff --git a/src/__tests__/run.js b/src/__tests__/run.js index f0df9c6..6498afa 100644 --- a/src/__tests__/run.js +++ b/src/__tests__/run.js @@ -3,27 +3,24 @@ const { runAudits } = require( '../run' ); describe( 'Run the audits', () => { it( 'runs with a configuration object', () => { const config = { - "format": "json", - "audits": [ - "colors", - "important", - "display-none", - "selectors", - "media-queries", + format: 'json', + audits: [ + 'colors', + 'important', + 'display-none', + 'selectors', + 'media-queries', + [ 'property-values', [ 'font-size' ] ], [ - "property-values", - [ "font-size" ] - ], - [ - "property-values", + 'property-values', [ - "padding-top", - "padding-bottom", - "padding-left", - "padding-right" - ] - ] - ] + 'padding-top', + 'padding-bottom', + 'padding-left', + 'padding-right', + ], + ], + ], }; const result = runAudits( config, [ { @@ -32,19 +29,14 @@ describe( 'Run the audits', () => { }, ] ); - config.audits.forEach( audit => { - + config.audits.forEach( ( audit ) => { if ( Array.isArray( audit ) ) { - - audit[1].forEach( property => { + audit[ 1 ].forEach( ( property ) => { expect( result ).toContain( property ); - }); - + } ); } else { - expect( result ).toContain( audit ); - } - }); + } ); } ); } ); diff --git a/src/formats/html.js b/src/formats/html.js index 31ca2c5..31eabd0 100644 --- a/src/formats/html.js +++ b/src/formats/html.js @@ -1,6 +1,6 @@ const fs = require( 'fs-extra' ); const path = require( 'path' ); -const { exit } = require('process'); +const { exit } = require( 'process' ); const { TwingEnvironment, TwingLoaderFilesystem } = require( 'twing' ); /** @@ -27,8 +27,9 @@ const getTemplateSrc = ( name ) => { }; module.exports = function ( reports ) { - - const loader = new TwingLoaderFilesystem( path.join( __dirname, './templates' ) ); + const loader = new TwingLoaderFilesystem( + path.join( __dirname, './templates' ) + ); const twing = new TwingEnvironment( loader, { debug: true } ); const reportName = getArgFromCLI( '--filename' ); @@ -39,9 +40,15 @@ module.exports = function ( reports ) { ); const colorsData = reports.filter( ( { audit } ) => 'colors' === audit ); - const selectorsData = reports.filter( ( { audit } ) => 'selectors' === audit ); - const importantData = reports.filter( ( { audit } ) => 'important' === audit ); - const displayNoneData = reports.filter( ( { audit } ) => 'display-none' === audit ); + const selectorsData = reports.filter( + ( { audit } ) => 'selectors' === audit + ); + const importantData = reports.filter( + ( { audit } ) => 'important' === audit + ); + const displayNoneData = reports.filter( + ( { audit } ) => 'display-none' === audit + ); const context = { colorsData, diff --git a/src/run.js b/src/run.js index dd31523..8b15597 100644 --- a/src/run.js +++ b/src/run.js @@ -33,7 +33,7 @@ const runAuditsFromCLIArgs = ( cssFiles ) => { ); } - console.log(audits); + console.log( audits ); const reports = audits.flat().filter( Boolean ); @@ -41,7 +41,6 @@ const runAuditsFromCLIArgs = ( cssFiles ) => { // console.log( reports ); return formatReport( reports, format ); - }; const runAuditsFromConfig = ( config, cssFiles ) => { @@ -49,36 +48,32 @@ const runAuditsFromConfig = ( config, cssFiles ) => { const { format } = config; // TODO: Support value for config arg, and default to css-audit.config filename - config.audits.forEach( audit => { - + config.audits.forEach( ( audit ) => { if ( Array.isArray( audit ) ) { - const [ auditName, auditTerms ] = audit; audits.push( - require( `./audits/${auditName}` )( - cssFiles, - auditTerms - ) + require( `./audits/${ auditName }` )( cssFiles, auditTerms ) ); } else { - audits.push( require( `./audits/${audit}` )( cssFiles ) ); + audits.push( require( `./audits/${ audit }` )( cssFiles ) ); } - - }); + } ); const reports = audits.flat().filter( Boolean ); return formatReport( reports, format ); -} +}; const runAudits = ( config = {}, cssFiles ) => { - - const result = 0 < Object.keys( config ).length ? runAuditsFromConfig( config, cssFiles ) : runAuditsFromCLIArgs( cssFiles ); + const result = + 0 < Object.keys( config ).length + ? runAuditsFromConfig( config, cssFiles ) + : runAuditsFromCLIArgs( cssFiles ); return result; -} +}; module.exports = { - runAudits + runAudits, }; From 92a1cd3c2b496bf21869d789b6823e49e0cb9754 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 12 Nov 2020 16:54:14 -0500 Subject: [PATCH 09/47] fix: linter fixes --- src/formats/html.js | 12 +++++------- src/run.js | 3 --- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/formats/html.js b/src/formats/html.js index 31eabd0..eb5b415 100644 --- a/src/formats/html.js +++ b/src/formats/html.js @@ -1,6 +1,5 @@ const fs = require( 'fs-extra' ); const path = require( 'path' ); -const { exit } = require( 'process' ); const { TwingEnvironment, TwingLoaderFilesystem } = require( 'twing' ); /** @@ -11,14 +10,13 @@ const { getArgFromCLI } = require( '../utils/cli' ); /** * Get the source of a template to compile. * - * @param {string} subdir * @param {string} name * - * @returns {string} Template contnet + * @return {string} Template contnet */ const getTemplateSrc = ( name ) => { - const templatePath = ( name ) => - path.join( __dirname, `./templates/${ name }.twig` ); + const templatePath = ( tmplName ) => + path.join( __dirname, `./templates/${ tmplName }.twig` ); // Allow a new base template that matches the report name. const fileName = fs.existsSync( templatePath( name ) ) ? name : 'report'; @@ -61,10 +59,10 @@ module.exports = function ( reports ) { twing .render( reportTemplate, context ) .then( ( output ) => { - console.log( `Generated template for ${ reportName }.` ); + console.log( `Generated template for ${ reportName }.` ); // eslint-disable-line no-console fs.writeFileSync( reportDest, output ); } ) .catch( ( e ) => { - console.error( e ); + console.error( e ); // eslint-disable-line no-console } ); }; diff --git a/src/run.js b/src/run.js index 8b15597..157fc9b 100644 --- a/src/run.js +++ b/src/run.js @@ -33,13 +33,10 @@ const runAuditsFromCLIArgs = ( cssFiles ) => { ); } - console.log( audits ); - const reports = audits.flat().filter( Boolean ); const format = getArgFromCLI( '--format' ); - // console.log( reports ); return formatReport( reports, format ); }; From 1ea038479d75d46b64411d95954b4c3883c172fd Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 12 Nov 2020 16:54:23 -0500 Subject: [PATCH 10/47] chore: nvmrc and package lock --- .nvmrc | 1 + package-lock.json | 735 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 597 insertions(+), 139 deletions(-) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..da2d398 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +14 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 23cae7e..2b7a71a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -442,23 +442,6 @@ "minimist": "^1.2.0" } }, - "@eslint/eslintrc": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.3.tgz", - "integrity": "sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA==", - "requires": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "lodash": "^4.17.19", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - } - }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -772,6 +755,12 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==" }, + "@types/luxon": { + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.25.0.tgz", + "integrity": "sha512-iIJp2CP6C32gVqI08HIYnzqj55tlLnodIBMCcMf28q9ckqMfMzocCmIzd9JWI/ALLPMUiTkCu1JGv3FFtu6t3g==", + "dev": true + }, "@types/node": { "version": "14.11.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.2.tgz", @@ -875,8 +864,7 @@ "acorn": { "version": "7.4.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", - "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", - "dev": true + "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==" }, "acorn-globals": { "version": "6.0.0", @@ -910,16 +898,10 @@ "uri-js": "^4.2.2" } }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==" - }, "ansi-escapes": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", - "dev": true, "requires": { "type-fest": "^0.11.0" }, @@ -927,8 +909,7 @@ "type-fest": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", - "dev": true + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==" } } }, @@ -1054,6 +1035,11 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -1301,6 +1287,12 @@ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, + "capitalize": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/capitalize/-/capitalize-1.0.0.tgz", + "integrity": "sha1-3IAsWAruEBkpAg0soUtMqKCuRL4=", + "dev": true + }, "capture-exit": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", @@ -1331,6 +1323,11 @@ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -1360,6 +1357,14 @@ } } }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "requires": { + "restore-cursor": "^3.1.0" + } + }, "cli-table3": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.0.tgz", @@ -1370,6 +1375,11 @@ "string-width": "^4.2.0" } }, + "cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" + }, "cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -1381,6 +1391,12 @@ "wrap-ansi": "^6.2.0" } }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -1489,6 +1505,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1498,10 +1515,17 @@ "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true } } }, + "crypto-js": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.3.0.tgz", + "integrity": "sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q==", + "dev": true + }, "css-color-list": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/css-color-list/-/css-color-list-0.0.1.tgz", @@ -1608,6 +1632,15 @@ "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", "dev": true }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "^1.0.2" + } + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -1730,14 +1763,6 @@ "once": "^1.4.0" } }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "requires": { - "ansi-colors": "^4.1.1" - } - }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1774,6 +1799,12 @@ "is-symbol": "^1.0.2" } }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -1819,23 +1850,21 @@ } }, "eslint": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz", - "integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", "requires": { "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.1.3", "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", "debug": "^4.0.1", "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "eslint-scope": "^5.1.0", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^1.3.0", - "espree": "^7.3.0", - "esquery": "^1.2.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", + "esquery": "^1.0.1", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", "functional-red-black-tree": "^1.0.1", @@ -1844,24 +1873,81 @@ "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", "is-glob": "^4.0.0", "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash": "^4.17.19", + "levn": "^0.3.0", + "lodash": "^4.17.14", "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", + "optionator": "^0.8.3", "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", "table": "^5.2.3", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -1869,6 +1955,61 @@ "requires": { "esutils": "^2.0.2" } + }, + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } } } }, @@ -1974,20 +2115,13 @@ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" }, "espree": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", - "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", + "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", "requires": { - "acorn": "^7.4.0", + "acorn": "^7.1.1", "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.3.0" - }, - "dependencies": { - "acorn": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", - "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==" - } + "eslint-visitor-keys": "^1.1.0" } }, "esprima": { @@ -2025,6 +2159,12 @@ } } }, + "esrever": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/esrever/-/esrever-0.2.0.tgz", + "integrity": "sha1-lunSj08bGnZ4TNXUkOquAQ50B7g=", + "dev": true + }, "estraverse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", @@ -2198,6 +2338,16 @@ } } }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -2298,6 +2448,14 @@ "bser": "2.1.1" } }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "file-entry-cache": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", @@ -2382,6 +2540,17 @@ "map-cache": "^0.2.2" } }, + "fs-extra": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", + "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2495,8 +2664,7 @@ "graceful-fs": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", - "dev": true + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" }, "growly": { "version": "1.3.0", @@ -2505,6 +2673,19 @@ "dev": true, "optional": true }, + "handlebars": { + "version": "4.7.6", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz", + "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==", + "dev": true, + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -2622,6 +2803,12 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "htmlspecialchars": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/htmlspecialchars/-/htmlspecialchars-1.0.5.tgz", + "integrity": "sha1-9DD4wdXzcJvnvrrqaW3ASCQwajA=", + "dev": true + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -2643,7 +2830,6 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -2698,6 +2884,26 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "inquirer": { + "version": "7.3.3", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", + "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.19", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.6.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + } + }, "internal-slot": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.2.tgz", @@ -2821,6 +3027,12 @@ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, + "is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", + "dev": true + }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -2840,6 +3052,15 @@ "is-extglob": "^2.1.1" } }, + "is-integer": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-integer/-/is-integer-1.0.7.tgz", + "integrity": "sha1-a96Bqs3feLZZtmKdYpytxRqIbVw=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, "is-negative-zero": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", @@ -3577,6 +3798,22 @@ "minimist": "^1.2.5" } }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + }, + "dependencies": { + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + } + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -3629,28 +3866,19 @@ "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", "dev": true }, + "levenshtein": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/levenshtein/-/levenshtein-1.0.5.tgz", + "integrity": "sha1-ORFzepy1baNF0Aj1V4LG8TiXm6M=", + "dev": true + }, "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "dependencies": { - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "requires": { - "prelude-ls": "^1.2.1" - } - } + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" } }, "lines-and-columns": { @@ -3667,6 +3895,15 @@ "p-locate": "^4.1.0" } }, + "locutus": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/locutus/-/locutus-2.0.14.tgz", + "integrity": "sha512-0H1o1iHNEp3kJ5rW57bT/CAP5g6Qm0Zd817Wcx2+rOMTYyIJoc482Ja1v9dB6IUjwvWKcBNdYi7x2lRXtlJ3bA==", + "dev": true, + "requires": { + "es6-promise": "^4.2.5" + } + }, "lodash": { "version": "4.17.20", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", @@ -3686,6 +3923,18 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "lower-case": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", + "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", + "dev": true + }, + "luxon": { + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.25.0.tgz", + "integrity": "sha512-hEgLurSH8kQRjY6i4YLey+mcKVAWXbDNlZRmM6AgWDJ1cY3atl8Ztf5wEY7VBReFbmGnwQPz7KYJblL8B2k0jQ==", + "dev": true + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -3732,6 +3981,12 @@ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.6.tgz", "integrity": "sha512-rQvjv71olwNHgiTbfPZFkJtjNMciWgswYeciZhtvWLO8bmX3TnhyA62I6sTWOyZssWHJJjY6/KiWwqQsWWsqOA==" }, + "merge": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz", + "integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==", + "dev": true + }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -3766,8 +4021,7 @@ "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, "minimatch": { "version": "3.0.4", @@ -3816,6 +4070,11 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -3840,11 +4099,25 @@ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "no-case": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", + "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", + "dev": true, + "requires": { + "lower-case": "^1.1.1" + } }, "node-int64": { "version": "0.4.0", @@ -3956,6 +4229,12 @@ } } }, + "object-hash": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-1.3.1.tgz", + "integrity": "sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA==", + "dev": true + }, "object-inspect": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", @@ -4060,39 +4339,28 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, "requires": { "mimic-fn": "^2.1.0" } }, "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - }, - "dependencies": { - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "requires": { - "prelude-ls": "^1.2.1" - } - } + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" } }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, "p-each-series": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz", @@ -4129,6 +4397,15 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "pad": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pad/-/pad-2.3.0.tgz", + "integrity": "sha512-lxrgnOG5AXmzMRT1O5urWtYFxHnFSE+QntgTHij1nvS4W+ubhQLmQRHmZXDeEvk9I00itAixLqU9Q6fE0gW3sw==", + "dev": true, + "requires": { + "wcwidth": "^1.0.1" + } + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -4174,8 +4451,7 @@ "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" }, "path-parse": { "version": "1.0.6", @@ -4226,13 +4502,12 @@ "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" }, "prettier": { - "version": "npm:prettier@2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==" + "version": "npm:wp-prettier@2.0.5", + "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz", + "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==" }, "prettier-linter-helpers": { "version": "1.0.0", @@ -4357,6 +4632,12 @@ "safe-regex": "^1.1.0" } }, + "regex-parser": { + "version": "2.2.11", + "resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.11.tgz", + "integrity": "sha512-jbD/FT0+9MBU2XAZluI7w2OBs1RBi6p9M83nkoZayQXXU9e8Robt69FcZc7wU4eJD/YFTjn1JdCk3rbMJajz8Q==", + "dev": true + }, "regexp.prototype.flags": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", @@ -4367,9 +4648,9 @@ } }, "regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==" }, "regextras": { "version": "0.7.1", @@ -4518,6 +4799,15 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -4549,6 +4839,25 @@ "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==", "dev": true }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==" + }, + "runes": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/runes/-/runes-0.4.3.tgz", + "integrity": "sha512-K6p9y4ZyL9wPzA+PMDloNQPfoDGTiFYDvdlXznyGKgD10BJpcAosvATKrExRKOrNLgD8E7Um7WGW0lxsnOuNLg==", + "dev": true + }, + "rxjs": { + "version": "6.6.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", + "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -4567,8 +4876,7 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sane": { "version": "4.1.0", @@ -4758,6 +5066,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, "requires": { "shebang-regex": "^3.0.0" } @@ -4765,7 +5074,8 @@ "shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true }, "shellwords": { "version": "0.1.1", @@ -4807,8 +5117,7 @@ "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" }, "sisteransi": { "version": "1.0.5", @@ -4860,6 +5169,15 @@ } } }, + "snake-case": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-2.1.0.tgz", + "integrity": "sha1-Qb2xtz8w7GagTU4srRt2OH1NbZ8=", + "dev": true, + "requires": { + "no-case": "^2.2.0" + } + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -5317,11 +5635,24 @@ "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", "dev": true }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, "tinycolor2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "tmpl": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", @@ -5422,11 +5753,100 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "dev": true }, + "twig-lexer": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/twig-lexer/-/twig-lexer-0.7.2.tgz", + "integrity": "sha512-c+SyqPvjH1fDXIdW9E6oWMNGGB0f5Ua64ggEh/3AGUEIImkAGTzVdOY09qLaK1NhLCUSfT/JEjr8VnZbOaZDjg==", + "dev": true, + "requires": { + "@types/node": "^12.0.8" + }, + "dependencies": { + "@types/node": { + "version": "12.19.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.4.tgz", + "integrity": "sha512-o3oj1bETk8kBwzz1WlO6JWL/AfAA3Vm6J1B3C9CsdxHYp7XgPiH7OEXPUbZTndHlRaIElrANkQfe6ZmfJb3H2w==", + "dev": true + } + } + }, + "twing": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/twing/-/twing-5.0.2.tgz", + "integrity": "sha512-uyOnD+KUTH+Ddbs21/KVJJI8DFhlDLNJLEU5UrudGS1W1qLyyCho9HxSus9LUzIjYRYNifXiQnlYwzi2aWI0Pg==", + "dev": true, + "requires": { + "@types/luxon": "^1.4.0", + "camelcase": "^4.1.0", + "capitalize": "^1.0.0", + "crypto-js": "^3.1.9-1", + "esrever": "^0.2.0", + "fs-extra": "^5.0.0", + "htmlspecialchars": "^1.0.5", + "iconv-lite": "^0.4.19", + "is-integer": "^1.0.7", + "is-number": "^5.0.0", + "is-plain-object": "^2.0.4", + "isobject": "^3.0.1", + "levenshtein": "^1.0.5", + "locutus": "^2.0.11", + "luxon": "^1.19.3", + "merge": "^1.2.1", + "object-hash": "^1.2.0", + "pad": "^2.0.3", + "regex-parser": "^2.2.8", + "runes": "^0.4.3", + "snake-case": "^2.1.0", + "source-map": "^0.6.1", + "tmp": "0.0.33", + "twig-lexer": "^0.7.2", + "utf8-binary-cutter": "^0.9.2" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "is-number": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-5.0.0.tgz", + "integrity": "sha512-LmVHHP5dTJwrwZg2Jjqp7K5jpvcnYvYD1LMpvGadMsMv5+WXoDSLBQ0+zmuBJmuZGh2J2K845ygj/YukxUnr4A==", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + } + } + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, "requires": { "prelude-ls": "~1.1.2" } @@ -5451,6 +5871,13 @@ "is-typedarray": "^1.0.0" } }, + "uglify-js": { + "version": "3.11.5", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.11.5.tgz", + "integrity": "sha512-btvv/baMqe7HxP7zJSF7Uc16h1mSfuuSplT0/qdjxseesDU+yYzH33eHBH+eMdeRXwujXspaCTooWHQVVBh09w==", + "dev": true, + "optional": true + }, "union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", @@ -5463,6 +5890,11 @@ "set-value": "^2.0.1" } }, + "universalify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==" + }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -5523,6 +5955,15 @@ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, + "utf8-binary-cutter": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/utf8-binary-cutter/-/utf8-binary-cutter-0.9.2.tgz", + "integrity": "sha512-lS/2TaA9idsyafus4+WaB+C/AfL3JD85C/sgMJBpplZay1G5SwTQcxmd4jiJLI1VxSJr6a3yuNicBxD+iU2MKQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, "uuid": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", @@ -5531,9 +5972,9 @@ "optional": true }, "v8-compile-cache": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", - "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", + "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==" }, "v8-to-istanbul": { "version": "5.0.1", @@ -5602,6 +6043,15 @@ "makeerror": "1.0.x" } }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", @@ -5638,6 +6088,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "requires": { "isexe": "^2.0.0" } @@ -5653,6 +6104,12 @@ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, "wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", From de02b3a35788d1eb8518ead652e87923bea3ef00 Mon Sep 17 00:00:00 2001 From: laras126 Date: Tue, 24 Nov 2020 16:56:44 -0500 Subject: [PATCH 11/47] test: cli test for get arg --- src/utils/__tests__/cli.js | 121 ++++++++++++++++++ .../__tests__/fixtures/css-audit.config.js | 12 ++ 2 files changed, 133 insertions(+) create mode 100644 src/utils/__tests__/cli.js create mode 100644 src/utils/__tests__/fixtures/css-audit.config.js diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js new file mode 100644 index 0000000..676fcf6 --- /dev/null +++ b/src/utils/__tests__/cli.js @@ -0,0 +1,121 @@ +const { getArgFromCLI, getArgsFromCLI } = require( '../cli' ); +const path = require( 'path' ); + +const getArg = ( arg ) => { + + for ( const cliArg of getArgsFromCLI() ) { + const [ name, value ] = cliArg.split( '=' ); + if ( name === arg ) { + return 'undefined' === typeof value ? true : value || null; + } + } + + + const config = require( path.join( process.cwd(), 'css-audit.config.js' ) ); + + const getValue = ( term, key ) => { + let value = config[key]; + + console.log( term ); + + if ( Array === typeof term ) { + console.log( 'arry' ); + return value[1]; + } + + if ( term === key ) { + return 'undefined' === typeof value ? true : value; + } + + getValue( term, key ); + } + + for ( const key of Object.keys( config ) ) { + const term = arg.slice(2); + + return getValue( term ); + } +}; + + + +describe( 'Get args', () => { + + it.only( 'should get the value for simple args and arrays', () => { + + const config = { + 'single': 'value', + 'list': [ + 'key1', + [ 'key2', 'value in array' ] + ] + }; + + const getValue = ( term ) => { + + const configKeys = Object.keys( config ); + + const checkTerm = ( list ) => { + + if ( 0 === list.length ) { + return 'not found'; + } + + const key = list[0]; + + // console.log( key === term ); + // console.log( config[term] ); + + if ( key === term && !! config[term] ) { + return 'hmm'; + return config[term]; + } + + if ( Array === typeof config[key] ) { + + if ( term === config[key][0] ) { + console.log('config[key][0]'); + return config[key][0]; + } + + console.log('nothon'); + return checkTerm( config[key] ); + } + }; + + return checkTerm( configKeys ); + + }; + + expect( getValue( 'single' ) ).toBe( 'value' ); + expect( getValue( 'key1' ) ).toBe( 'key1'); + // expect( getValue( 'key2' ) ).toBe( 'value in array'); + + }); + + it( 'should get args from the CLI', () => { + process.argv = [ '', '', '--format=html', '--property-values=padding,padding-top', '--media-queries' ]; + + expect( getArgsFromCLI() ).toEqual( + ['--format=html', '--property-values=padding,padding-top', '--media-queries'] + ); + }); + + it( 'should get an individual argument from CLI', () => { + process.argv = [ '', '', '--media-queries', '--property-values=padding,padding-top' ]; + + expect( getArg( '--media-queries' ) ).toBe( true ); + expect( getArg( '--property-values' ) ).toBe( 'padding,padding-top' ); + }); + + it( 'should fallback to a config file if CLI arg is not available', () => { + process.argv = [ '', '', '' ]; + process.cwd = () => path.join( __dirname, 'fixtures' ); + + expect( getArg( '--format' ) ).toBe( 'json' ); + expect( getArg( '--media-queries' ) ).toBe( true ); + expect( getArg( '--property-values' ) ).toBe( 'padding-top,padding-bottom' ); + + }); + +}); diff --git a/src/utils/__tests__/fixtures/css-audit.config.js b/src/utils/__tests__/fixtures/css-audit.config.js new file mode 100644 index 0000000..f69e62d --- /dev/null +++ b/src/utils/__tests__/fixtures/css-audit.config.js @@ -0,0 +1,12 @@ +module.exports = { + format: 'json', + audits: [ + 'colors', + 'important', + 'display-none', + 'selectors', + 'media-queries', + [ 'property-values', 'font-size' ], + [ 'property-values', 'padding-top,padding-bottom' ], + ], +}; \ No newline at end of file From 0ec24cf80c07dc0736be1c58425fb628998264d6 Mon Sep 17 00:00:00 2001 From: laras126 Date: Tue, 24 Nov 2020 17:57:56 -0500 Subject: [PATCH 12/47] feat: working through cases for get arg --- src/utils/__tests__/cli.js | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 676fcf6..cc75f73 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -58,29 +58,28 @@ describe( 'Get args', () => { const checkTerm = ( list ) => { if ( 0 === list.length ) { - return 'not found'; + return false; } const key = list[0]; - // console.log( key === term ); - // console.log( config[term] ); - - if ( key === term && !! config[term] ) { - return 'hmm'; - return config[term]; + if ( key === term ) { + return 'undefined' === typeof config[term] ? true : config[term]; } - - if ( Array === typeof config[key] ) { + ; + if ( config[key].includes(term) ) { if ( term === config[key][0] ) { - console.log('config[key][0]'); - return config[key][0]; + return true; } - - console.log('nothon'); - return checkTerm( config[key] ); + return 'object??'; } + + list.shift(); + + return checkTerm( list ); + + }; return checkTerm( configKeys ); @@ -88,8 +87,8 @@ describe( 'Get args', () => { }; expect( getValue( 'single' ) ).toBe( 'value' ); - expect( getValue( 'key1' ) ).toBe( 'key1'); - // expect( getValue( 'key2' ) ).toBe( 'value in array'); + expect( getValue( 'key1' ) ).toBe( true ); + expect( getValue( 'key2' ) ).toBe( 'value in array'); }); From 33044637d1b0c2117dc6b0f21930b1e94f789420 Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 2 Dec 2020 18:36:09 -0500 Subject: [PATCH 13/47] feat: working fns in test! --- src/utils/__tests__/cli.js | 88 ++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index cc75f73..4d95d9d 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,6 +1,46 @@ const { getArgFromCLI, getArgsFromCLI } = require( '../cli' ); const path = require( 'path' ); +const getValue = ( term ) => { + + for (const key in config) { + + if ( config.hasOwnProperty(key) ) { + + if ( term === key ) { + return 'undefined' === typeof config[term] ? true : config[term]; + } + } + + if ( 'object' === typeof config[key] ) { + return getValueFromList( config[key], term ); + } + + } +}; + +const getValueFromList = ( list, term ) => { + + if ( 0 === list.length ) { + return false; + } + + const currItem = list[0]; + + if ( term === currItem ) { + return true; + } + + if ( term === currItem[0] ) { + return currItem[1]; + } + + list.shift(); + + return getValueFromList( list, term ); + +}; + const getArg = ( arg ) => { for ( const cliArg of getArgsFromCLI() ) { @@ -38,7 +78,6 @@ const getArg = ( arg ) => { }; - describe( 'Get args', () => { it.only( 'should get the value for simple args and arrays', () => { @@ -51,47 +90,24 @@ describe( 'Get args', () => { ] }; - const getValue = ( term ) => { - - const configKeys = Object.keys( config ); - - const checkTerm = ( list ) => { - - if ( 0 === list.length ) { - return false; - } - - const key = list[0]; - - if ( key === term ) { - return 'undefined' === typeof config[term] ? true : config[term]; - } - ; - if ( config[key].includes(term) ) { - - if ( term === config[key][0] ) { - return true; - } - return 'object??'; - } - - list.shift(); - - return checkTerm( list ); - - - }; - - return checkTerm( configKeys ); - - }; - expect( getValue( 'single' ) ).toBe( 'value' ); expect( getValue( 'key1' ) ).toBe( true ); expect( getValue( 'key2' ) ).toBe( 'value in array'); }); + it.only( 'should recursively get required values from an array in the config', () => { + + const testList = [ + 'key1', + 'key2', + [ 'key3', 'value' ] + ]; + + expect( getValueFromList( testList, 'key2' ) ).toBe( true ); + expect( getValueFromList( testList, 'key3' ) ).toBe( 'value' ); + }) + it( 'should get args from the CLI', () => { process.argv = [ '', '', '--format=html', '--property-values=padding,padding-top', '--media-queries' ]; From ccbe8284875875c2dad9c38a0a9a50e5ebf8e0f6 Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 2 Dec 2020 18:56:01 -0500 Subject: [PATCH 14/47] test: passing for config fallback --- src/utils/__tests__/cli.js | 45 +++++++++-------------------- test.js | 58 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 31 deletions(-) create mode 100644 test.js diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 4d95d9d..de7005b 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,7 +1,7 @@ const { getArgFromCLI, getArgsFromCLI } = require( '../cli' ); const path = require( 'path' ); -const getValue = ( term ) => { +const getValue = ( config, term ) => { for (const key in config) { @@ -43,44 +43,27 @@ const getValueFromList = ( list, term ) => { const getArg = ( arg ) => { - for ( const cliArg of getArgsFromCLI() ) { - const [ name, value ] = cliArg.split( '=' ); - if ( name === arg ) { - return 'undefined' === typeof value ? true : value || null; - } - } - - const config = require( path.join( process.cwd(), 'css-audit.config.js' ) ); - const getValue = ( term, key ) => { - let value = config[key]; - - console.log( term ); + for ( const cliArg of getArgsFromCLI() ) { - if ( Array === typeof term ) { - console.log( 'arry' ); - return value[1]; - } + const [ name, value ] = cliArg.split( '=' ); - if ( term === key ) { - return 'undefined' === typeof value ? true : value; + if ( name === arg ) { + return 'undefined' === typeof value ? true : value || null; } - getValue( term, key ); } - for ( const key of Object.keys( config ) ) { - const term = arg.slice(2); + const term = arg.substr(2); - return getValue( term ); - } -}; + return getValue( config, term ); +}; describe( 'Get args', () => { - it.only( 'should get the value for simple args and arrays', () => { + it( 'should get the value for simple args and arrays', () => { const config = { 'single': 'value', @@ -90,13 +73,13 @@ describe( 'Get args', () => { ] }; - expect( getValue( 'single' ) ).toBe( 'value' ); - expect( getValue( 'key1' ) ).toBe( true ); - expect( getValue( 'key2' ) ).toBe( 'value in array'); + expect( getValue( config, 'single' ) ).toBe( 'value' ); + expect( getValue( config, 'key1' ) ).toBe( true ); + expect( getValue( config, 'key2' ) ).toBe( 'value in array'); }); - it.only( 'should recursively get required values from an array in the config', () => { + it( 'should recursively get required values from an array values in the config', () => { const testList = [ 'key1', @@ -129,7 +112,7 @@ describe( 'Get args', () => { expect( getArg( '--format' ) ).toBe( 'json' ); expect( getArg( '--media-queries' ) ).toBe( true ); - expect( getArg( '--property-values' ) ).toBe( 'padding-top,padding-bottom' ); + expect( getArg( '--property-values' ) ).toBe( 'font-size' ); }); diff --git a/test.js b/test.js new file mode 100644 index 0000000..7451a11 --- /dev/null +++ b/test.js @@ -0,0 +1,58 @@ +const config = { + 'single': 'value', + 'list': [ + 'key1', + [ 'key2', 'value in array' ], + 'key3' + ] +}; + +const getValue = ( term ) => { + + const configKeys = Object.keys( config ); + + const checkTerm = ( list ) => { + + if ( 0 === list.length ) { + return false; + } + + const key = list[0]; + + console.log('--',key, '--'); + + if ( key === term ) { + console.log( term, 'key is term ✅'); + return 'undefined' === typeof config[term] ? true : config[term]; + } +; + console.log('term:', term, ' in config[key],', config[key].includes(term) ); + + if ( config[key].includes(term) ) { + + console.log('in an array value'); + + if ( term === config[key][0] ) { + return true; + } + + console.log( config[key][0] ); + return checkTerm( config[key][0] ); + } + + console.log('continue...'); + + list.shift(); + + console.log( list ); + + + + }; + + return checkTerm( configKeys ); + +}; + +// console.log( getValue( 'single' ) ); +console.log( getValue( 'key2' ) ); \ No newline at end of file From 3369fa178bd574691afae0fa6e1ec566a66b2f91 Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 14:33:20 -0500 Subject: [PATCH 15/47] feat: move fns out of test --- src/utils/__tests__/cli.js | 62 +------------------------ src/utils/cli.js | 95 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 92 insertions(+), 65 deletions(-) diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index de7005b..c3dc3d8 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,66 +1,6 @@ -const { getArgFromCLI, getArgsFromCLI } = require( '../cli' ); +const { getArg, getValueFromList, getValue, getArgsFromCLI } = require( '../cli' ); const path = require( 'path' ); -const getValue = ( config, term ) => { - - for (const key in config) { - - if ( config.hasOwnProperty(key) ) { - - if ( term === key ) { - return 'undefined' === typeof config[term] ? true : config[term]; - } - } - - if ( 'object' === typeof config[key] ) { - return getValueFromList( config[key], term ); - } - - } -}; - -const getValueFromList = ( list, term ) => { - - if ( 0 === list.length ) { - return false; - } - - const currItem = list[0]; - - if ( term === currItem ) { - return true; - } - - if ( term === currItem[0] ) { - return currItem[1]; - } - - list.shift(); - - return getValueFromList( list, term ); - -}; - -const getArg = ( arg ) => { - - const config = require( path.join( process.cwd(), 'css-audit.config.js' ) ); - - for ( const cliArg of getArgsFromCLI() ) { - - const [ name, value ] = cliArg.split( '=' ); - - if ( name === arg ) { - return 'undefined' === typeof value ? true : value || null; - } - - } - - const term = arg.substr(2); - - return getValue( config, term ); - -}; - describe( 'Get args', () => { it( 'should get the value for simple args and arrays', () => { diff --git a/src/utils/cli.js b/src/utils/cli.js index 2b66c87..2bd0f7b 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -1,6 +1,7 @@ /** * External dependencies */ +const path = require( 'path' ); const minimist = require( 'minimist' ); const getArgsFromCLI = ( excludePrefixes ) => { @@ -15,16 +16,100 @@ const getArgsFromCLI = ( excludePrefixes ) => { return args; }; -const getArgFromCLI = ( arg ) => { +const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; + +/** + * Get the value of a term from the configuration object. + * + * For each entry in configuration: + * If is a key for the term, return its value. + * If the term is present in the list of audits, return true. + * If the term is in an array in the list of audits, return + * the second item in the array, which will be the value. + * + * @param {object} config + * @param {string} term + */ +const getValue = ( config, term ) => { + for (const key in config) { + if ( config.hasOwnProperty(key) ) { + if ( term === key ) { + return 'undefined' === typeof config[term] ? true : config[term]; + } + } + if ( 'object' === typeof config[key] ) { + return getValueFromList( config[key], term ); + } + } +}; + +/** + * Get the config value for audit types that require an argument, + * e.g. property-values. + * + * Given an array and a term, return true if the term is in + * the array, and if the term is not in the array and there is + * a nested array, return the second item of the array who's + * first item is the term. + * + * getValueFromList( + * [ 'term', [ 'term-2', 'value' ] ], + * 'term' + * ) - returns true + * + * getValueFromList( + * [ 'term', [ 'term-2', 'value' ] ], + * 'term-2' + * ) - returns 'value' + * + * @param {array} list + * @param {string} term + */ +const getValueFromList = ( list, term ) => { + + if ( 0 === list.length ) { + return false; + } + + const currItem = list[0]; + + if ( term === currItem ) { + return true; + } + + if ( term === currItem[0] ) { + return currItem[1]; + } + + list.shift(); + + return getValueFromList( list, term ); + +}; + +/** + * Get the argument required for running the audit, + * + * First get the argument from CLI, and fallback to the + * config if its not present. + * + * @param {string} arg + */ + +const getArg = ( arg ) => { + + // Maybe we don't want to hard code this? Allow for other file names? + const config = require( path.join( process.cwd(), 'css-audit.config.js' ) ); + for ( const cliArg of getArgsFromCLI() ) { const [ name, value ] = cliArg.split( '=' ); if ( name === arg ) { return 'undefined' === typeof value ? true : value || null; } } -}; -const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; + return getValue( config, arg.substr(2) ); +}; const getHelp = () => { return `Usage: css-audit -- [options] @@ -43,8 +128,10 @@ const getHelp = () => { }; module.exports = { - getArgFromCLI, getArgsFromCLI, getFileArgsFromCLI, + getValue, + getValueFromList, + getArg, getHelp, }; From 8629201d1a8ff7f953eac36fe2d9a6083acd4f1b Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 14:36:59 -0500 Subject: [PATCH 16/47] feat: try adding github workflow for tests --- .github/workflows/node.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/node.yaml diff --git a/.github/workflows/node.yaml b/.github/workflows/node.yaml new file mode 100644 index 0000000..2ad395b --- /dev/null +++ b/.github/workflows/node.yaml @@ -0,0 +1,23 @@ +name: Node.js CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [8.x, 10.x, 12.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + env: + CI: true \ No newline at end of file From a2cf2c2591f371525b10d9d28f68ff35b09fcbd4 Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 14:39:18 -0500 Subject: [PATCH 17/47] fix: node version --- .github/workflows/node.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.yaml b/.github/workflows/node.yaml index 2ad395b..d7ea5f0 100644 --- a/.github/workflows/node.yaml +++ b/.github/workflows/node.yaml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - node-version: [8.x, 10.x, 12.x] + node-version: [14.x] steps: - uses: actions/checkout@v2 From 77098203eab51667c87ade862ec3126d8484965a Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 14:45:54 -0500 Subject: [PATCH 18/47] test: skip failing and ignore fixtures --- package.json | 3 +++ src/__tests__/colors.js | 2 +- test.js | 58 ----------------------------------------- 3 files changed, 4 insertions(+), 59 deletions(-) delete mode 100644 test.js diff --git a/package.json b/package.json index 703ded6..6d8d8fa 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,9 @@ "jest": true } }, + "jest": { + "modulePathIgnorePatterns": ["fixtures"] + }, "prettier": "@wordpress/prettier-config", "devDependencies": { "handlebars": "4.7.6", diff --git a/src/__tests__/colors.js b/src/__tests__/colors.js index 2e3dc4d..5355f3e 100644 --- a/src/__tests__/colors.js +++ b/src/__tests__/colors.js @@ -13,7 +13,7 @@ describe( 'Audit: Colors', () => { expect( value ).toBe( 0 ); } ); - it( 'should ignore colors in non-color properties', () => { + it.skip( 'should ignore colors in non-color properties', () => { const files = [ { name: 'a.css', diff --git a/test.js b/test.js deleted file mode 100644 index 7451a11..0000000 --- a/test.js +++ /dev/null @@ -1,58 +0,0 @@ -const config = { - 'single': 'value', - 'list': [ - 'key1', - [ 'key2', 'value in array' ], - 'key3' - ] -}; - -const getValue = ( term ) => { - - const configKeys = Object.keys( config ); - - const checkTerm = ( list ) => { - - if ( 0 === list.length ) { - return false; - } - - const key = list[0]; - - console.log('--',key, '--'); - - if ( key === term ) { - console.log( term, 'key is term ✅'); - return 'undefined' === typeof config[term] ? true : config[term]; - } -; - console.log('term:', term, ' in config[key],', config[key].includes(term) ); - - if ( config[key].includes(term) ) { - - console.log('in an array value'); - - if ( term === config[key][0] ) { - return true; - } - - console.log( config[key][0] ); - return checkTerm( config[key][0] ); - } - - console.log('continue...'); - - list.shift(); - - console.log( list ); - - - - }; - - return checkTerm( configKeys ); - -}; - -// console.log( getValue( 'single' ) ); -console.log( getValue( 'key2' ) ); \ No newline at end of file From c5c85610eaec296d2220d159fdda7e8a9e3a79f0 Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 14:52:34 -0500 Subject: [PATCH 19/47] fix: format js --- src/utils/__tests__/cli.js | 63 ++++++++++++++++++++------------------ src/utils/cli.js | 23 +++++++------- 2 files changed, 45 insertions(+), 41 deletions(-) diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index c3dc3d8..71936f5 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,50 +1,57 @@ -const { getArg, getValueFromList, getValue, getArgsFromCLI } = require( '../cli' ); +const { + getArg, + getValueFromList, + getValue, + getArgsFromCLI, +} = require( '../cli' ); const path = require( 'path' ); describe( 'Get args', () => { - it( 'should get the value for simple args and arrays', () => { - const config = { - 'single': 'value', - 'list': [ - 'key1', - [ 'key2', 'value in array' ] - ] + single: 'value', + list: [ 'key1', [ 'key2', 'value in array' ] ], }; expect( getValue( config, 'single' ) ).toBe( 'value' ); expect( getValue( config, 'key1' ) ).toBe( true ); - expect( getValue( config, 'key2' ) ).toBe( 'value in array'); - - }); + expect( getValue( config, 'key2' ) ).toBe( 'value in array' ); + } ); it( 'should recursively get required values from an array values in the config', () => { - - const testList = [ - 'key1', - 'key2', - [ 'key3', 'value' ] - ]; + const testList = [ 'key1', 'key2', [ 'key3', 'value' ] ]; expect( getValueFromList( testList, 'key2' ) ).toBe( true ); expect( getValueFromList( testList, 'key3' ) ).toBe( 'value' ); - }) + } ); it( 'should get args from the CLI', () => { - process.argv = [ '', '', '--format=html', '--property-values=padding,padding-top', '--media-queries' ]; + process.argv = [ + '', + '', + '--format=html', + '--property-values=padding,padding-top', + '--media-queries', + ]; - expect( getArgsFromCLI() ).toEqual( - ['--format=html', '--property-values=padding,padding-top', '--media-queries'] - ); - }); + expect( getArgsFromCLI() ).toEqual( [ + '--format=html', + '--property-values=padding,padding-top', + '--media-queries', + ] ); + } ); it( 'should get an individual argument from CLI', () => { - process.argv = [ '', '', '--media-queries', '--property-values=padding,padding-top' ]; + process.argv = [ + '', + '', + '--media-queries', + '--property-values=padding,padding-top', + ]; expect( getArg( '--media-queries' ) ).toBe( true ); expect( getArg( '--property-values' ) ).toBe( 'padding,padding-top' ); - }); + } ); it( 'should fallback to a config file if CLI arg is not available', () => { process.argv = [ '', '', '' ]; @@ -53,7 +60,5 @@ describe( 'Get args', () => { expect( getArg( '--format' ) ).toBe( 'json' ); expect( getArg( '--media-queries' ) ).toBe( true ); expect( getArg( '--property-values' ) ).toBe( 'font-size' ); - - }); - -}); + } ); +} ); diff --git a/src/utils/cli.js b/src/utils/cli.js index 2bd0f7b..fa92ca5 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -31,14 +31,16 @@ const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; * @param {string} term */ const getValue = ( config, term ) => { - for (const key in config) { - if ( config.hasOwnProperty(key) ) { + for ( const key in config ) { + if ( config.hasOwnProperty( key ) ) { if ( term === key ) { - return 'undefined' === typeof config[term] ? true : config[term]; + return 'undefined' === typeof config[ term ] + ? true + : config[ term ]; } } - if ( 'object' === typeof config[key] ) { - return getValueFromList( config[key], term ); + if ( 'object' === typeof config[ key ] ) { + return getValueFromList( config[ key ], term ); } } }; @@ -66,25 +68,23 @@ const getValue = ( config, term ) => { * @param {string} term */ const getValueFromList = ( list, term ) => { - if ( 0 === list.length ) { return false; } - const currItem = list[0]; + const currItem = list[ 0 ]; if ( term === currItem ) { return true; } - if ( term === currItem[0] ) { - return currItem[1]; + if ( term === currItem[ 0 ] ) { + return currItem[ 1 ]; } list.shift(); return getValueFromList( list, term ); - }; /** @@ -97,7 +97,6 @@ const getValueFromList = ( list, term ) => { */ const getArg = ( arg ) => { - // Maybe we don't want to hard code this? Allow for other file names? const config = require( path.join( process.cwd(), 'css-audit.config.js' ) ); @@ -108,7 +107,7 @@ const getArg = ( arg ) => { } } - return getValue( config, arg.substr(2) ); + return getValue( config, arg.substr( 2 ) ); }; const getHelp = () => { From 99c1920d77d213dca3bae77d27797d0aa4972ec2 Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 16:33:47 -0500 Subject: [PATCH 20/47] fix: add additional prettier paths --- css-audit.config.js | 25 +++++++++++-------------- index.js | 6 +++++- package.json | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/css-audit.config.js b/css-audit.config.js index 48bb2ef..88b8d89 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -1,18 +1,15 @@ module.exports = { - "format": "cli-table", - "audits": [ + format: 'cli-table', + audits: [ + [ 'property-values', [ 'font-size' ] ], [ - "property-values", - [ "font-size" ] - ], - [ - "property-values", + 'property-values', [ - "padding-top", - "padding-bottom", - "padding-left", - "padding-right" - ] - ] - ] + 'padding-top', + 'padding-bottom', + 'padding-left', + 'padding-right', + ], + ], + ], }; diff --git a/index.js b/index.js index 92b4f7f..9c16af1 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,11 @@ const path = require( 'path' ); * Internal dependencies */ const { runAudits } = require( './src/run' ); -const { getArgFromCLI, getFileArgsFromCLI, getHelp } = require( './src/utils/cli' ); +const { + getArgFromCLI, + getFileArgsFromCLI, + getHelp, +} = require( './src/utils/cli' ); const config = require( './css-audit.config' ); const input = getFileArgsFromCLI(); diff --git a/package.json b/package.json index 6d8d8fa..3bad6d2 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "css-audit": "node ./index.js", "lint:js": "eslint src", - "format:js": "prettier {src,.}/**/*.js --write", + "format:js": "prettier {src,.}/**/*.js src/**/**/*.js --write", "test": "jest" }, "author": "Kelly Dwan", From b78fad8dbd7d5aa6ceabadddebbbb831570d8ad2 Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 16:39:06 -0500 Subject: [PATCH 21/47] feat: update getArg calls, better names --- index.js | 4 ++-- src/run.js | 22 +++++++++++----------- src/utils/__tests__/cli.js | 14 +++++++------- src/utils/cli.js | 23 +++++++++++++---------- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/index.js b/index.js index 9c16af1..2d323e3 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ const path = require( 'path' ); */ const { runAudits } = require( './src/run' ); const { - getArgFromCLI, + getArg, getFileArgsFromCLI, getHelp, } = require( './src/utils/cli' ); @@ -17,7 +17,7 @@ const { const config = require( './css-audit.config' ); const input = getFileArgsFromCLI(); -if ( getArgFromCLI( '--help' ) || ! input.length ) { +if ( getArg( '--help', true ) || ! input.length ) { console.log( getHelp() ); // eslint-disable-line no-console process.exit( 0 ); } diff --git a/src/run.js b/src/run.js index 157fc9b..cd45516 100644 --- a/src/run.js +++ b/src/run.js @@ -2,40 +2,40 @@ * Internal dependencies */ const { formatReport } = require( './utils/format-report' ); -const { getArgFromCLI } = require( './utils/cli' ); +const { getArg } = require( './utils/cli' ); const runAuditsFromCLIArgs = ( cssFiles ) => { const audits = []; - const runAll = getArgFromCLI( '--all' ); - const runRecommended = getArgFromCLI( '--recommended' ); + const runAll = getArg( '--all' ); + const runRecommended = getArg( '--recommended' ); - if ( runAll || runRecommended || getArgFromCLI( '--colors' ) ) { + if ( runAll || runRecommended || getArg( '--colors' ) ) { audits.push( require( './audits/colors' )( cssFiles ) ); } - if ( runAll || runRecommended || getArgFromCLI( '--important' ) ) { + if ( runAll || runRecommended || getArg( '--important' ) ) { audits.push( require( './audits/important' )( cssFiles ) ); } - if ( runAll || getArgFromCLI( '--display-none' ) ) { + if ( runAll || getArg( '--display-none' ) ) { audits.push( require( './audits/display-none' )( cssFiles ) ); } - if ( runAll || runRecommended || getArgFromCLI( '--selectors' ) ) { + if ( runAll || runRecommended || getArg( '--selectors' ) ) { audits.push( require( './audits/selectors' )( cssFiles ) ); } - if ( runAll || runRecommended || getArgFromCLI( '--media-queries' ) ) { + if ( runAll || runRecommended || getArg( '--media-queries' ) ) { audits.push( require( './audits/media-queries' )( cssFiles ) ); } - if ( !! getArgFromCLI( '--property-values' ) ) { + if ( !! getArg( '--property-values' ) ) { audits.push( require( './audits/property-values' )( cssFiles, - getArgFromCLI( '--property-values' ).split( ',' ) + getArg( '--property-values' ).split( ',' ) ) ); } const reports = audits.flat().filter( Boolean ); - const format = getArgFromCLI( '--format' ); + const format = getArg( '--format' ); return formatReport( reports, format ); }; diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 71936f5..8ee56ac 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,7 +1,7 @@ const { getArg, - getValueFromList, - getValue, + getValueFromConfigList, + getValueFromConfig, getArgsFromCLI, } = require( '../cli' ); const path = require( 'path' ); @@ -13,16 +13,16 @@ describe( 'Get args', () => { list: [ 'key1', [ 'key2', 'value in array' ] ], }; - expect( getValue( config, 'single' ) ).toBe( 'value' ); - expect( getValue( config, 'key1' ) ).toBe( true ); - expect( getValue( config, 'key2' ) ).toBe( 'value in array' ); + expect( getValueFromConfig( config, 'single' ) ).toBe( 'value' ); + expect( getValueFromConfig( config, 'key1' ) ).toBe( true ); + expect( getValueFromConfig( config, 'key2' ) ).toBe( 'value in array' ); } ); it( 'should recursively get required values from an array values in the config', () => { const testList = [ 'key1', 'key2', [ 'key3', 'value' ] ]; - expect( getValueFromList( testList, 'key2' ) ).toBe( true ); - expect( getValueFromList( testList, 'key3' ) ).toBe( 'value' ); + expect( getValueFromConfigList( testList, 'key2' ) ).toBe( true ); + expect( getValueFromConfigList( testList, 'key3' ) ).toBe( 'value' ); } ); it( 'should get args from the CLI', () => { diff --git a/src/utils/cli.js b/src/utils/cli.js index fa92ca5..d816f22 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -30,7 +30,7 @@ const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; * @param {object} config * @param {string} term */ -const getValue = ( config, term ) => { +const getValueFromConfig = ( config, term ) => { for ( const key in config ) { if ( config.hasOwnProperty( key ) ) { if ( term === key ) { @@ -40,7 +40,7 @@ const getValue = ( config, term ) => { } } if ( 'object' === typeof config[ key ] ) { - return getValueFromList( config[ key ], term ); + return getValueFromConfigList( config[ key ], term ); } } }; @@ -54,12 +54,12 @@ const getValue = ( config, term ) => { * a nested array, return the second item of the array who's * first item is the term. * - * getValueFromList( + * getValueFromConfigList( * [ 'term', [ 'term-2', 'value' ] ], * 'term' * ) - returns true * - * getValueFromList( + * getValueFromConfigList( * [ 'term', [ 'term-2', 'value' ] ], * 'term-2' * ) - returns 'value' @@ -67,7 +67,7 @@ const getValue = ( config, term ) => { * @param {array} list * @param {string} term */ -const getValueFromList = ( list, term ) => { +const getValueFromConfigList = ( list, term ) => { if ( 0 === list.length ) { return false; } @@ -84,7 +84,7 @@ const getValueFromList = ( list, term ) => { list.shift(); - return getValueFromList( list, term ); + return getValueFromConfigList( list, term ); }; /** @@ -94,9 +94,10 @@ const getValueFromList = ( list, term ) => { * config if its not present. * * @param {string} arg + * @param {bool} cliOnly */ -const getArg = ( arg ) => { +const getArg = ( arg, cliOnly = false ) => { // Maybe we don't want to hard code this? Allow for other file names? const config = require( path.join( process.cwd(), 'css-audit.config.js' ) ); @@ -107,7 +108,9 @@ const getArg = ( arg ) => { } } - return getValue( config, arg.substr( 2 ) ); + if ( ! cliOnly ) { + return getValueFromConfig( config, arg.substr( 2 ) ); + } }; const getHelp = () => { @@ -129,8 +132,8 @@ const getHelp = () => { module.exports = { getArgsFromCLI, getFileArgsFromCLI, - getValue, - getValueFromList, + getValueFromConfig, + getValueFromConfigList, getArg, getHelp, }; From 973db0e6fc90da556477fc57e214dc9a9277622a Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 16:45:11 -0500 Subject: [PATCH 22/47] fix: option for cliOnly in getArg --- src/utils/__tests__/cli.js | 7 +++++++ src/utils/cli.js | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 8ee56ac..f3f5f8e 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -61,4 +61,11 @@ describe( 'Get args', () => { expect( getArg( '--media-queries' ) ).toBe( true ); expect( getArg( '--property-values' ) ).toBe( 'font-size' ); } ); + + it( 'should return false if config is not supported for the arg', () => { + process.argv = [ '', '', '' ]; + process.cwd = () => path.join( __dirname, 'fixtures' ); + + expect( getArg( '--help', true ) ).toBe( false ); + } ); } ); diff --git a/src/utils/cli.js b/src/utils/cli.js index d816f22..c6881fa 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -111,6 +111,8 @@ const getArg = ( arg, cliOnly = false ) => { if ( ! cliOnly ) { return getValueFromConfig( config, arg.substr( 2 ) ); } + + return false; }; const getHelp = () => { From cf9a85d56348cdbce1b52badea7532faba562745 Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 16:45:24 -0500 Subject: [PATCH 23/47] chore: incl root js in prettier --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3bad6d2..7b8949d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "css-audit": "node ./index.js", "lint:js": "eslint src", - "format:js": "prettier {src,.}/**/*.js src/**/**/*.js --write", + "format:js": "prettier *.js {src,.}/**/*.js src/**/**/*.js --write", "test": "jest" }, "author": "Kelly Dwan", From 296c20a2de30abb6ae00e529810d86e31bc6496c Mon Sep 17 00:00:00 2001 From: laras126 Date: Fri, 4 Dec 2020 16:47:07 -0500 Subject: [PATCH 24/47] fix: typo --- src/formats/html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/formats/html.js b/src/formats/html.js index 5a483be..adbf811 100644 --- a/src/formats/html.js +++ b/src/formats/html.js @@ -5,7 +5,7 @@ const { TwingEnvironment, TwingLoaderFilesystem } = require( 'twing' ); /** * Internal dependencies */ -const { getArgFromCLI } = require( '../utils/cli' ); +const { getArg } = require( '../utils/cli' ); const templatePath = path.join( __dirname, './templates' ); @@ -26,7 +26,7 @@ module.exports = function ( reports ) { const loader = new TwingLoaderFilesystem( templatePath ); const twing = new TwingEnvironment( loader, { debug: true } ); - const reportName = getArgFromCLI( '--filename' ); + const reportName = getArg( '--filename' ); const reportTemplate = getTemplateFile( reportName ); const reportDest = path.join( __dirname, From d69b01bcf992e9e1105f142e8c7062ac0e47a221 Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 9 Dec 2020 13:54:29 -0500 Subject: [PATCH 25/47] fix: return new arr --- src/utils/cli.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils/cli.js b/src/utils/cli.js index c6881fa..73b25cd 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -31,6 +31,7 @@ const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; * @param {string} term */ const getValueFromConfig = ( config, term ) => { + for ( const key in config ) { if ( config.hasOwnProperty( key ) ) { if ( term === key ) { @@ -40,7 +41,9 @@ const getValueFromConfig = ( config, term ) => { } } if ( 'object' === typeof config[ key ] ) { - return getValueFromConfigList( config[ key ], term ); + const list = () => config[ key ]; + + return getValueFromConfigList( list, term ); } } }; @@ -97,9 +100,9 @@ const getValueFromConfigList = ( list, term ) => { * @param {bool} cliOnly */ +const config = require( path.join( process.cwd(), 'css-audit.config.js' ) ); + const getArg = ( arg, cliOnly = false ) => { - // Maybe we don't want to hard code this? Allow for other file names? - const config = require( path.join( process.cwd(), 'css-audit.config.js' ) ); for ( const cliArg of getArgsFromCLI() ) { const [ name, value ] = cliArg.split( '=' ); From 475867c79533644601d5008b9f809ba5cd1abf01 Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 9 Dec 2020 15:52:54 -0500 Subject: [PATCH 26/47] fix: consolidate run audits, but confused --- index.js | 3 +-- src/run.js | 33 +-------------------------------- src/utils/__tests__/cli.js | 28 ++++++++++++++-------------- src/utils/cli.js | 32 ++++++++++++++++++++++++++------ 4 files changed, 42 insertions(+), 54 deletions(-) diff --git a/index.js b/index.js index 2d323e3..b1aa23b 100644 --- a/index.js +++ b/index.js @@ -14,7 +14,6 @@ const { getHelp, } = require( './src/utils/cli' ); -const config = require( './css-audit.config' ); const input = getFileArgsFromCLI(); if ( getArg( '--help', true ) || ! input.length ) { @@ -38,6 +37,6 @@ input.forEach( ( file ) => { } ); } ); -const result = runAudits( config, cssFiles ); +const result = runAudits( cssFiles ); console.log( result ); diff --git a/src/run.js b/src/run.js index cd45516..6461bfc 100644 --- a/src/run.js +++ b/src/run.js @@ -4,7 +4,7 @@ const { formatReport } = require( './utils/format-report' ); const { getArg } = require( './utils/cli' ); -const runAuditsFromCLIArgs = ( cssFiles ) => { +const runAudits = ( cssFiles ) => { const audits = []; const runAll = getArg( '--all' ); const runRecommended = getArg( '--recommended' ); @@ -40,37 +40,6 @@ const runAuditsFromCLIArgs = ( cssFiles ) => { return formatReport( reports, format ); }; -const runAuditsFromConfig = ( config, cssFiles ) => { - const audits = []; - const { format } = config; - - // TODO: Support value for config arg, and default to css-audit.config filename - config.audits.forEach( ( audit ) => { - if ( Array.isArray( audit ) ) { - const [ auditName, auditTerms ] = audit; - - audits.push( - require( `./audits/${ auditName }` )( cssFiles, auditTerms ) - ); - } else { - audits.push( require( `./audits/${ audit }` )( cssFiles ) ); - } - } ); - - const reports = audits.flat().filter( Boolean ); - - return formatReport( reports, format ); -}; - -const runAudits = ( config = {}, cssFiles ) => { - const result = - 0 < Object.keys( config ).length - ? runAuditsFromConfig( config, cssFiles ) - : runAuditsFromCLIArgs( cssFiles ); - - return result; -}; - module.exports = { runAudits, }; diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index f3f5f8e..34eccd1 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -7,16 +7,6 @@ const { const path = require( 'path' ); describe( 'Get args', () => { - it( 'should get the value for simple args and arrays', () => { - const config = { - single: 'value', - list: [ 'key1', [ 'key2', 'value in array' ] ], - }; - - expect( getValueFromConfig( config, 'single' ) ).toBe( 'value' ); - expect( getValueFromConfig( config, 'key1' ) ).toBe( true ); - expect( getValueFromConfig( config, 'key2' ) ).toBe( 'value in array' ); - } ); it( 'should recursively get required values from an array values in the config', () => { const testList = [ 'key1', 'key2', [ 'key3', 'value' ] ]; @@ -53,18 +43,28 @@ describe( 'Get args', () => { expect( getArg( '--property-values' ) ).toBe( 'padding,padding-top' ); } ); - it( 'should fallback to a config file if CLI arg is not available', () => { + it( 'should return false if an arg does not exist in CLI or config', () => { + process.argv = [ + '', + '', + '--media-queries', + ]; + + expect( getArg( '--nonexistant' ) ).toBe( false ); + }) + + it.only( 'should fallback to the config file if CLI arg is not available', () => { process.argv = [ '', '', '' ]; - process.cwd = () => path.join( __dirname, 'fixtures' ); + // These values are in fixtures/css-audit.config.js expect( getArg( '--format' ) ).toBe( 'json' ); + expect( getArg( '--important' ) ).toBe( true ); expect( getArg( '--media-queries' ) ).toBe( true ); expect( getArg( '--property-values' ) ).toBe( 'font-size' ); } ); - it( 'should return false if config is not supported for the arg', () => { + it( 'should return false if arg is CLI only', () => { process.argv = [ '', '', '' ]; - process.cwd = () => path.join( __dirname, 'fixtures' ); expect( getArg( '--help', true ) ).toBe( false ); } ); diff --git a/src/utils/cli.js b/src/utils/cli.js index 73b25cd..a90f500 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -32,20 +32,23 @@ const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; */ const getValueFromConfig = ( config, term ) => { - for ( const key in config ) { + return Object.keys( config ).forEach( ( key ) => { + if ( config.hasOwnProperty( key ) ) { if ( term === key ) { + return 'undefined' === typeof config[ term ] ? true : config[ term ]; } } + if ( 'object' === typeof config[ key ] ) { - const list = () => config[ key ]; + const list = ( () => config[ key ] )(); return getValueFromConfigList( list, term ); } - } + }); }; /** @@ -76,6 +79,7 @@ const getValueFromConfigList = ( list, term ) => { } const currItem = list[ 0 ]; + const listCopy = ( () => list )(); if ( term === currItem ) { return true; @@ -85,9 +89,9 @@ const getValueFromConfigList = ( list, term ) => { return currItem[ 1 ]; } - list.shift(); + listCopy.shift(); - return getValueFromConfigList( list, term ); + return getValueFromConfigList( listCopy, term ); }; /** @@ -100,10 +104,17 @@ const getValueFromConfigList = ( list, term ) => { * @param {bool} cliOnly */ -const config = require( path.join( process.cwd(), 'css-audit.config.js' ) ); const getArg = ( arg, cliOnly = false ) => { + const configPath = () => { + if ( 'test' === process.env.NODE_ENV ) { + return path.join( __dirname, '/__tests__/fixtures/css-audit.config.js' ); + } + + return path.join( process.cwd(), 'css-audit.config.js' ); + }; + for ( const cliArg of getArgsFromCLI() ) { const [ name, value ] = cliArg.split( '=' ); if ( name === arg ) { @@ -112,6 +123,15 @@ const getArg = ( arg, cliOnly = false ) => { } if ( ! cliOnly ) { + + const config = ( () => { + try { + return require( configPath() ) ; + } catch { + console.error( 'Can\'t find config file. \nMake sure there is css-audit.config.js in the directory where you run this command.' ); + } + } )(); + return getValueFromConfig( config, arg.substr( 2 ) ); } From 997efb6ab0aaffd980a9d6290f6d6fa81af2bf91 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 10 Dec 2020 12:57:20 -0500 Subject: [PATCH 27/47] refact: clean up tests, some passing --- src/utils/__tests__/cli.js | 58 +++++++++++++++++---------- src/utils/cli.js | 82 ++++++++++++++++++-------------------- 2 files changed, 76 insertions(+), 64 deletions(-) diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 34eccd1..3eb5ddf 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,19 +1,11 @@ const { getArg, getValueFromConfigList, - getValueFromConfig, getArgsFromCLI, } = require( '../cli' ); const path = require( 'path' ); -describe( 'Get args', () => { - - it( 'should recursively get required values from an array values in the config', () => { - const testList = [ 'key1', 'key2', [ 'key3', 'value' ] ]; - - expect( getValueFromConfigList( testList, 'key2' ) ).toBe( true ); - expect( getValueFromConfigList( testList, 'key3' ) ).toBe( 'value' ); - } ); +describe( 'Run Audits from CLI', () => { it( 'should get args from the CLI', () => { process.argv = [ @@ -31,41 +23,65 @@ describe( 'Get args', () => { ] ); } ); - it( 'should get an individual argument from CLI', () => { + it( 'should return true for basic audit args in the CLI', () => { process.argv = [ '', '', '--media-queries', - '--property-values=padding,padding-top', ]; expect( getArg( '--media-queries' ) ).toBe( true ); - expect( getArg( '--property-values' ) ).toBe( 'padding,padding-top' ); } ); - it( 'should return false if an arg does not exist in CLI or config', () => { + + it( 'should return values for args that have them in the CLI', () => { process.argv = [ '', '', - '--media-queries', + '--property-values=padding,padding-top', ]; - expect( getArg( '--nonexistant' ) ).toBe( false ); - }) + expect( getArg( '--property-values' ) ).toBe( 'padding,padding-top' ); + } ); - it.only( 'should fallback to the config file if CLI arg is not available', () => { +} ); + +describe( 'Run Audits from Config', () => { + beforeAll( () => { process.argv = [ '', '', '' ]; + }); + + it( 'should recursively get required values from an array values in the config', () => { + const testList = [ 'key1', 'key2', [ 'key3', 'value' ] ]; - // These values are in fixtures/css-audit.config.js + expect( getValueFromConfigList( testList, 'key2' ) ).toBe( true ); + expect( getValueFromConfigList( testList, 'key3' ) ).toBe( 'value' ); + } ); + + it( 'should return the value for config keys', () => { expect( getArg( '--format' ) ).toBe( 'json' ); + }); + + it( 'should return true if the arg is a item in the config audits array', () => { expect( getArg( '--important' ) ).toBe( true ); - expect( getArg( '--media-queries' ) ).toBe( true ); + } ); + + it( 'should return the value for property-values in an array nested in the config audits array', () => { expect( getArg( '--property-values' ) ).toBe( 'font-size' ); } ); it( 'should return false if arg is CLI only', () => { - process.argv = [ '', '', '' ]; - expect( getArg( '--help', true ) ).toBe( false ); } ); + + + it( 'should return false if an arg does not exist in CLI or config', () => { + process.argv = [ + '', + '', + '--media-queries', + ]; + + expect( getArg( '--nonexistant' ) ).toBe( false ); + } ); } ); diff --git a/src/utils/cli.js b/src/utils/cli.js index a90f500..f85f5d4 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -18,38 +18,6 @@ const getArgsFromCLI = ( excludePrefixes ) => { const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; -/** - * Get the value of a term from the configuration object. - * - * For each entry in configuration: - * If is a key for the term, return its value. - * If the term is present in the list of audits, return true. - * If the term is in an array in the list of audits, return - * the second item in the array, which will be the value. - * - * @param {object} config - * @param {string} term - */ -const getValueFromConfig = ( config, term ) => { - - return Object.keys( config ).forEach( ( key ) => { - - if ( config.hasOwnProperty( key ) ) { - if ( term === key ) { - - return 'undefined' === typeof config[ term ] - ? true - : config[ term ]; - } - } - - if ( 'object' === typeof config[ key ] ) { - const list = ( () => config[ key ] )(); - - return getValueFromConfigList( list, term ); - } - }); -}; /** * Get the config value for audit types that require an argument, @@ -104,19 +72,20 @@ const getValueFromConfigList = ( list, term ) => { * @param {bool} cliOnly */ +// TODO: we can use cosmiconfig for this +const configPath = () => { + if ( 'test' === process.env.NODE_ENV ) { + return path.join( __dirname, '/__tests__/fixtures/css-audit.config.js' ); + } -const getArg = ( arg, cliOnly = false ) => { - - const configPath = () => { - if ( 'test' === process.env.NODE_ENV ) { - return path.join( __dirname, '/__tests__/fixtures/css-audit.config.js' ); - } + return path.join( process.cwd(), 'css-audit.config.js' ); +}; - return path.join( process.cwd(), 'css-audit.config.js' ); - }; +const getArg = ( arg, cliOnly = false ) => { for ( const cliArg of getArgsFromCLI() ) { const [ name, value ] = cliArg.split( '=' ); + if ( name === arg ) { return 'undefined' === typeof value ? true : value || null; } @@ -132,10 +101,38 @@ const getArg = ( arg, cliOnly = false ) => { } } )(); - return getValueFromConfig( config, arg.substr( 2 ) ); + const term = arg.substr( 2 ); + + if ( config.hasOwnProperty( term ) ) { + return 'undefined' === typeof config[term] ? true : config[term] || null; + } + + let result = false; + + if ( config.hasOwnProperty( 'audits' ) ) { + + for (let index = 0; index < config['audits'].length; index++) { + const audit = config['audits'][index]; + + // It is an array + if ( 'object' === typeof audit ) { + const list = ( () => audit )(); + + result = getValueFromConfigList( list, term ); + break; + } + + if ( term === audit ) { + result = true; + break; + } + } + + } + + return result; } - return false; }; const getHelp = () => { @@ -157,7 +154,6 @@ const getHelp = () => { module.exports = { getArgsFromCLI, getFileArgsFromCLI, - getValueFromConfig, getValueFromConfigList, getArg, getHelp, From 35325441729c2b413ffdbcb9aece8e4774c76f17 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 10 Dec 2020 15:32:38 -0500 Subject: [PATCH 28/47] reafct: use array methods and fix bugs --- src/utils/__tests__/cli.js | 26 +++++---- src/utils/cli.js | 106 ++++++++++++------------------------- 2 files changed, 50 insertions(+), 82 deletions(-) diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 3eb5ddf..a6f3880 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,6 +1,5 @@ const { getArg, - getValueFromConfigList, getArgsFromCLI, } = require( '../cli' ); const path = require( 'path' ); @@ -13,12 +12,14 @@ describe( 'Run Audits from CLI', () => { '', '--format=html', '--property-values=padding,padding-top', + '--property-values=font-size,font-weight', '--media-queries', ]; expect( getArgsFromCLI() ).toEqual( [ '--format=html', '--property-values=padding,padding-top', + '--property-values=font-size,font-weight', '--media-queries', ] ); } ); @@ -51,12 +52,19 @@ describe( 'Run Audits from Config', () => { process.argv = [ '', '', '' ]; }); - it( 'should recursively get required values from an array values in the config', () => { - const testList = [ 'key1', 'key2', [ 'key3', 'value' ] ]; - - expect( getValueFromConfigList( testList, 'key2' ) ).toBe( true ); - expect( getValueFromConfigList( testList, 'key3' ) ).toBe( 'value' ); - } ); + it.skip( 'should get args from config', () => { + const config = { + format: 'json', + audits: [ + 'media-queries', + 'important', + ['property-values', 'font-size,font-family'] + ['property-values', 'margin,padding'] + ] + }; + + // const expectedArgs = + }); it( 'should return the value for config keys', () => { expect( getArg( '--format' ) ).toBe( 'json' ); @@ -66,8 +74,8 @@ describe( 'Run Audits from Config', () => { expect( getArg( '--important' ) ).toBe( true ); } ); - it( 'should return the value for property-values in an array nested in the config audits array', () => { - expect( getArg( '--property-values' ) ).toBe( 'font-size' ); + it( 'should return an array of values for each property-value audits', () => { + expect( getArg( '--property-values' ) ).toStrictEqual( ['font-size', 'padding-top,padding-bottom'] ); } ); it( 'should return false if arg is CLI only', () => { diff --git a/src/utils/cli.js b/src/utils/cli.js index f85f5d4..4145acf 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -18,50 +18,6 @@ const getArgsFromCLI = ( excludePrefixes ) => { const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; - -/** - * Get the config value for audit types that require an argument, - * e.g. property-values. - * - * Given an array and a term, return true if the term is in - * the array, and if the term is not in the array and there is - * a nested array, return the second item of the array who's - * first item is the term. - * - * getValueFromConfigList( - * [ 'term', [ 'term-2', 'value' ] ], - * 'term' - * ) - returns true - * - * getValueFromConfigList( - * [ 'term', [ 'term-2', 'value' ] ], - * 'term-2' - * ) - returns 'value' - * - * @param {array} list - * @param {string} term - */ -const getValueFromConfigList = ( list, term ) => { - if ( 0 === list.length ) { - return false; - } - - const currItem = list[ 0 ]; - const listCopy = ( () => list )(); - - if ( term === currItem ) { - return true; - } - - if ( term === currItem[ 0 ] ) { - return currItem[ 1 ]; - } - - listCopy.shift(); - - return getValueFromConfigList( listCopy, term ); -}; - /** * Get the argument required for running the audit, * @@ -91,48 +47,53 @@ const getArg = ( arg, cliOnly = false ) => { } } - if ( ! cliOnly ) { - - const config = ( () => { - try { - return require( configPath() ) ; - } catch { - console.error( 'Can\'t find config file. \nMake sure there is css-audit.config.js in the directory where you run this command.' ); - } - } )(); - - const term = arg.substr( 2 ); + if ( true === cliOnly ) { + return false; + } - if ( config.hasOwnProperty( term ) ) { - return 'undefined' === typeof config[term] ? true : config[term] || null; + // TODO: replace with cosmiconfig. + const config = ( () => { + try { + return require( configPath() ) ; + } catch { + console.error( 'Can\'t find config file. \nMake sure there is css-audit.config.js in the directory where you run this command.' ); } + } )(); - let result = false; + const term = arg.substr( 2 ); - if ( config.hasOwnProperty( 'audits' ) ) { + // This is a simple property: value arg e.g. format: json + const argIsNotAnAudit = config.hasOwnProperty( term ); - for (let index = 0; index < config['audits'].length; index++) { - const audit = config['audits'][index]; + if ( argIsNotAnAudit ) { + return 'undefined' === typeof config[term] ? true : config[term] || null; + } - // It is an array - if ( 'object' === typeof audit ) { - const list = ( () => audit )(); + if ( config.hasOwnProperty( 'audits' ) ) { - result = getValueFromConfigList( list, term ); - break; - } + // Separate the basic audits from property-values. + const basicAudits = config['audits'].filter( ( audit ) => term === audit && 'string' === typeof audit ); - if ( term === audit ) { - result = true; - break; - } + // Create an array of values of the property-value audits. + const propertyValueAudits = config['audits'].filter( ( audit ) => 'object' === typeof audit && term === audit[0]); + const propertyValueValues = ( () => { + if ( propertyValueAudits.length > 0 ) { + return propertyValueAudits.flat().filter( item => 'property-values' !== item ); } + return []; + })(); + if ( 'undefined' !== basicAudits[0] && term === basicAudits[0] ) { + return true; } - return result; + if ( propertyValueValues.length > 0 ) { + return propertyValueValues; + } } + // The argument cannot be retrieved from CLI or config. + return false; }; const getHelp = () => { @@ -154,7 +115,6 @@ const getHelp = () => { module.exports = { getArgsFromCLI, getFileArgsFromCLI, - getValueFromConfigList, getArg, getHelp, }; From 71c696e15071660180402cfadd4b1e2e83f5a9f6 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 10 Dec 2020 15:50:46 -0500 Subject: [PATCH 29/47] fix: update test, support for multiple property values --- src/__tests__/run.js | 29 +++++++---------------------- src/run.js | 22 ++++++++++++++++++++-- src/utils/__tests__/cli.js | 14 -------------- 3 files changed, 27 insertions(+), 38 deletions(-) diff --git a/src/__tests__/run.js b/src/__tests__/run.js index 6498afa..f49773e 100644 --- a/src/__tests__/run.js +++ b/src/__tests__/run.js @@ -1,28 +1,13 @@ +const path = require( 'path' ); const { runAudits } = require( '../run' ); describe( 'Run the audits', () => { it( 'runs with a configuration object', () => { - const config = { - format: 'json', - audits: [ - 'colors', - 'important', - 'display-none', - 'selectors', - 'media-queries', - [ 'property-values', [ 'font-size' ] ], - [ - 'property-values', - [ - 'padding-top', - 'padding-bottom', - 'padding-left', - 'padding-right', - ], - ], - ], - }; - const result = runAudits( config, [ + + // TODO: replace with cosmiconfig? + const config = require( path.join( __dirname, '../utils/__tests__/fixtures/css-audit.config.js' ) ); + + const result = runAudits( [ { name: 'a.css', content: `body { font-size: 1em !important; line-height: 1.6; }`, @@ -31,7 +16,7 @@ describe( 'Run the audits', () => { config.audits.forEach( ( audit ) => { if ( Array.isArray( audit ) ) { - audit[ 1 ].forEach( ( property ) => { + audit[ 1 ].split(',').forEach( ( property ) => { expect( result ).toContain( property ); } ); } else { diff --git a/src/run.js b/src/run.js index 6461bfc..472b190 100644 --- a/src/run.js +++ b/src/run.js @@ -24,11 +24,24 @@ const runAudits = ( cssFiles ) => { if ( runAll || runRecommended || getArg( '--media-queries' ) ) { audits.push( require( './audits/media-queries' )( cssFiles ) ); } - if ( !! getArg( '--property-values' ) ) { + + const propertyValues = getArg( '--property-values' ); + + // Multiple property value arguments are only supported in config. + if ( Array.isArray( propertyValues ) && propertyValues.length ) { + propertyValues.forEach( ( values ) => { + audits.push( + require( './audits/property-values' )( + cssFiles, + values.split( ',' ) + ) + ); + }) + } else { audits.push( require( './audits/property-values' )( cssFiles, - getArg( '--property-values' ).split( ',' ) + propertyValues.split( ',' ) ) ); } @@ -37,6 +50,11 @@ const runAudits = ( cssFiles ) => { const format = getArg( '--format' ); + if ( 'html' === format && ! getArg( '--filename' ) ) { + console.error( 'Could not run audits. \nAn argument for filename must be provided for the HTML format.' ); + return; + } + return formatReport( reports, format ); }; diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index a6f3880..258d995 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -52,20 +52,6 @@ describe( 'Run Audits from Config', () => { process.argv = [ '', '', '' ]; }); - it.skip( 'should get args from config', () => { - const config = { - format: 'json', - audits: [ - 'media-queries', - 'important', - ['property-values', 'font-size,font-family'] - ['property-values', 'margin,padding'] - ] - }; - - // const expectedArgs = - }); - it( 'should return the value for config keys', () => { expect( getArg( '--format' ) ).toBe( 'json' ); }); From 0086ddabb228f27948c7b3ef8db5a80bdc3d2f91 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 10 Dec 2020 15:51:04 -0500 Subject: [PATCH 30/47] fix: use all in config --- css-audit.config.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/css-audit.config.js b/css-audit.config.js index 88b8d89..ac5a9ce 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -1,15 +1,11 @@ +const { truncateSync } = require("fs-extra"); + module.exports = { - format: 'cli-table', + format: 'html', + filename: 'wp-admin', + all: true, audits: [ - [ 'property-values', [ 'font-size' ] ], - [ - 'property-values', - [ - 'padding-top', - 'padding-bottom', - 'padding-left', - 'padding-right', - ], - ], + [ 'property-values', 'font-size' ], + [ 'property-values', 'padding-top,padding-bottom,padding-left,padding-right' ], ], }; From d9131df457eb5ce564ec8d5c51c8e8311b8bcc6d Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 10 Dec 2020 15:52:59 -0500 Subject: [PATCH 31/47] fix: update config --- css-audit.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-audit.config.js b/css-audit.config.js index ac5a9ce..57c3e96 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -5,7 +5,7 @@ module.exports = { filename: 'wp-admin', all: true, audits: [ - [ 'property-values', 'font-size' ], + [ 'property-values', 'font-size,font-family,font-weight' ], [ 'property-values', 'padding-top,padding-bottom,padding-left,padding-right' ], ], }; From 72d224e34e1974a846299ba097fe2b7ac98686ee Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 10 Dec 2020 16:09:27 -0500 Subject: [PATCH 32/47] feat: hook up template --- src/formats/html.js | 19 +++++++++------ .../templates/audits/property-values.twig | 23 +++++++++++++++++++ src/formats/templates/report.twig | 7 +++--- 3 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 src/formats/templates/audits/property-values.twig diff --git a/src/formats/html.js b/src/formats/html.js index dceff77..5c766cb 100644 --- a/src/formats/html.js +++ b/src/formats/html.js @@ -43,20 +43,25 @@ module.exports = function ( reports ) { const displayNoneData = reports.filter( ( { audit } ) => 'display-none' === audit ); + const propertyValuesData = reports.filter( + ( { audit } ) => 'property-values' === audit + ); - // Create array of audit IDs for jump menu - const idsForNav = []; - if( colorsData.length ) idsForNav.push( "colors" ); - if( selectorsData.length ) idsForNav.push( "selectors" ); - if( importantData.length ) idsForNav.push( "important" ); - if( displayNoneData.length ) idsForNav.push( "display-none" ); + // Create array of audit IDs for jump menu + const idsForNav = []; + if( colorsData.length ) idsForNav.push( "colors" ); + if( selectorsData.length ) idsForNav.push( "selectors" ); + if( importantData.length ) idsForNav.push( "important" ); + if( displayNoneData.length ) idsForNav.push( "display-none" ); + if( propertyValuesData.length ) idsForNav.push( "property-values" ); const context = { - idsForNav, + idsForNav, colorsData, displayNoneData, importantData, selectorsData, + propertyValuesData, title: `CSS Audit for ${ reportName }`, }; diff --git a/src/formats/templates/audits/property-values.twig b/src/formats/templates/audits/property-values.twig new file mode 100644 index 0000000..9ab47e8 --- /dev/null +++ b/src/formats/templates/audits/property-values.twig @@ -0,0 +1,23 @@ +{% if data is iterable %} +
+

{{data[0].audit|capitalize}}

+ {% for item in data %} + {% if item.value is iterable %} +

{{item.label}}

+
    + {% for value in item.value %} + {% if value.name %} +
  • {{value.name}} - {{value.count}}
  • + {% endif %} + + {% if value.file %} +
  • {{value.file}} - {{value.selector}}
  • + {% endif %} + {% endfor %} +
+ {% else %} +

{{item.label}}: {{item.value}}

+ {% endif %} + {% endfor %} +
+{% endif %} \ No newline at end of file diff --git a/src/formats/templates/report.twig b/src/formats/templates/report.twig index be286a4..ecbcf21 100644 --- a/src/formats/templates/report.twig +++ b/src/formats/templates/report.twig @@ -7,13 +7,14 @@ {{title}} -

{{title}}

-
- {% include 'nav.twig' with { data: idsForNav } %} +

{{title}}

+
+ {% include 'nav.twig' with { data: idsForNav } %} {% include 'audits/colors.twig' with { data: colorsData } %} {% include 'audits/display-none.twig' with { data: displayNoneData } %} {% include 'audits/important.twig' with { data: importantData } %} {% include 'audits/selectors.twig' with { data: selectorsData } %} + {% include 'audits/property-values.twig' with { data: propertyValuesData } %} \ No newline at end of file From 6677eabf39b16a8b0447d9d51b0ab2bb81efd428 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 10 Dec 2020 16:26:35 -0500 Subject: [PATCH 33/47] fix: format js --- css-audit.config.js | 7 +++++-- index.js | 6 +----- src/__tests__/run.js | 8 +++++--- src/formats/html.js | 10 +++++----- src/run.js | 6 ++++-- src/utils/__tests__/cli.js | 36 ++++++++++-------------------------- src/utils/cli.js | 33 ++++++++++++++++++++++----------- 7 files changed, 52 insertions(+), 54 deletions(-) diff --git a/css-audit.config.js b/css-audit.config.js index 57c3e96..91f0c94 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -1,4 +1,4 @@ -const { truncateSync } = require("fs-extra"); +const { truncateSync } = require( 'fs-extra' ); module.exports = { format: 'html', @@ -6,6 +6,9 @@ module.exports = { all: true, audits: [ [ 'property-values', 'font-size,font-family,font-weight' ], - [ 'property-values', 'padding-top,padding-bottom,padding-left,padding-right' ], + [ + 'property-values', + 'padding-top,padding-bottom,padding-left,padding-right', + ], ], }; diff --git a/index.js b/index.js index b1aa23b..040dda8 100644 --- a/index.js +++ b/index.js @@ -8,11 +8,7 @@ const path = require( 'path' ); * Internal dependencies */ const { runAudits } = require( './src/run' ); -const { - getArg, - getFileArgsFromCLI, - getHelp, -} = require( './src/utils/cli' ); +const { getArg, getFileArgsFromCLI, getHelp } = require( './src/utils/cli' ); const input = getFileArgsFromCLI(); diff --git a/src/__tests__/run.js b/src/__tests__/run.js index f49773e..44d8f91 100644 --- a/src/__tests__/run.js +++ b/src/__tests__/run.js @@ -3,9 +3,11 @@ const { runAudits } = require( '../run' ); describe( 'Run the audits', () => { it( 'runs with a configuration object', () => { - // TODO: replace with cosmiconfig? - const config = require( path.join( __dirname, '../utils/__tests__/fixtures/css-audit.config.js' ) ); + const config = require( path.join( + __dirname, + '../utils/__tests__/fixtures/css-audit.config.js' + ) ); const result = runAudits( [ { @@ -16,7 +18,7 @@ describe( 'Run the audits', () => { config.audits.forEach( ( audit ) => { if ( Array.isArray( audit ) ) { - audit[ 1 ].split(',').forEach( ( property ) => { + audit[ 1 ].split( ',' ).forEach( ( property ) => { expect( result ).toContain( property ); } ); } else { diff --git a/src/formats/html.js b/src/formats/html.js index 5c766cb..e4bdb73 100644 --- a/src/formats/html.js +++ b/src/formats/html.js @@ -49,11 +49,11 @@ module.exports = function ( reports ) { // Create array of audit IDs for jump menu const idsForNav = []; - if( colorsData.length ) idsForNav.push( "colors" ); - if( selectorsData.length ) idsForNav.push( "selectors" ); - if( importantData.length ) idsForNav.push( "important" ); - if( displayNoneData.length ) idsForNav.push( "display-none" ); - if( propertyValuesData.length ) idsForNav.push( "property-values" ); + if ( colorsData.length ) idsForNav.push( 'colors' ); + if ( selectorsData.length ) idsForNav.push( 'selectors' ); + if ( importantData.length ) idsForNav.push( 'important' ); + if ( displayNoneData.length ) idsForNav.push( 'display-none' ); + if ( propertyValuesData.length ) idsForNav.push( 'property-values' ); const context = { idsForNav, diff --git a/src/run.js b/src/run.js index 472b190..9769a3a 100644 --- a/src/run.js +++ b/src/run.js @@ -36,7 +36,7 @@ const runAudits = ( cssFiles ) => { values.split( ',' ) ) ); - }) + } ); } else { audits.push( require( './audits/property-values' )( @@ -51,7 +51,9 @@ const runAudits = ( cssFiles ) => { const format = getArg( '--format' ); if ( 'html' === format && ! getArg( '--filename' ) ) { - console.error( 'Could not run audits. \nAn argument for filename must be provided for the HTML format.' ); + console.error( + 'Could not run audits. \nAn argument for filename must be provided for the HTML format.' + ); return; } diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 258d995..6322d6d 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,11 +1,7 @@ -const { - getArg, - getArgsFromCLI, -} = require( '../cli' ); +const { getArg, getArgsFromCLI } = require( '../cli' ); const path = require( 'path' ); describe( 'Run Audits from CLI', () => { - it( 'should get args from the CLI', () => { process.argv = [ '', @@ -25,56 +21,44 @@ describe( 'Run Audits from CLI', () => { } ); it( 'should return true for basic audit args in the CLI', () => { - process.argv = [ - '', - '', - '--media-queries', - ]; + process.argv = [ '', '', '--media-queries' ]; expect( getArg( '--media-queries' ) ).toBe( true ); } ); - it( 'should return values for args that have them in the CLI', () => { - process.argv = [ - '', - '', - '--property-values=padding,padding-top', - ]; + process.argv = [ '', '', '--property-values=padding,padding-top' ]; expect( getArg( '--property-values' ) ).toBe( 'padding,padding-top' ); } ); - } ); describe( 'Run Audits from Config', () => { beforeAll( () => { process.argv = [ '', '', '' ]; - }); + } ); it( 'should return the value for config keys', () => { expect( getArg( '--format' ) ).toBe( 'json' ); - }); + } ); it( 'should return true if the arg is a item in the config audits array', () => { expect( getArg( '--important' ) ).toBe( true ); } ); it( 'should return an array of values for each property-value audits', () => { - expect( getArg( '--property-values' ) ).toStrictEqual( ['font-size', 'padding-top,padding-bottom'] ); + expect( getArg( '--property-values' ) ).toStrictEqual( [ + 'font-size', + 'padding-top,padding-bottom', + ] ); } ); it( 'should return false if arg is CLI only', () => { expect( getArg( '--help', true ) ).toBe( false ); } ); - it( 'should return false if an arg does not exist in CLI or config', () => { - process.argv = [ - '', - '', - '--media-queries', - ]; + process.argv = [ '', '', '--media-queries' ]; expect( getArg( '--nonexistant' ) ).toBe( false ); } ); diff --git a/src/utils/cli.js b/src/utils/cli.js index 4145acf..0ba1fb8 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -31,14 +31,16 @@ const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; // TODO: we can use cosmiconfig for this const configPath = () => { if ( 'test' === process.env.NODE_ENV ) { - return path.join( __dirname, '/__tests__/fixtures/css-audit.config.js' ); + return path.join( + __dirname, + '/__tests__/fixtures/css-audit.config.js' + ); } return path.join( process.cwd(), 'css-audit.config.js' ); }; const getArg = ( arg, cliOnly = false ) => { - for ( const cliArg of getArgsFromCLI() ) { const [ name, value ] = cliArg.split( '=' ); @@ -54,9 +56,11 @@ const getArg = ( arg, cliOnly = false ) => { // TODO: replace with cosmiconfig. const config = ( () => { try { - return require( configPath() ) ; + return require( configPath() ); } catch { - console.error( 'Can\'t find config file. \nMake sure there is css-audit.config.js in the directory where you run this command.' ); + console.error( + "Can't find config file. \nMake sure there is css-audit.config.js in the directory where you run this command." + ); } } )(); @@ -66,24 +70,31 @@ const getArg = ( arg, cliOnly = false ) => { const argIsNotAnAudit = config.hasOwnProperty( term ); if ( argIsNotAnAudit ) { - return 'undefined' === typeof config[term] ? true : config[term] || null; + return 'undefined' === typeof config[ term ] + ? true + : config[ term ] || null; } if ( config.hasOwnProperty( 'audits' ) ) { - // Separate the basic audits from property-values. - const basicAudits = config['audits'].filter( ( audit ) => term === audit && 'string' === typeof audit ); + const basicAudits = config[ 'audits' ].filter( + ( audit ) => term === audit && 'string' === typeof audit + ); // Create an array of values of the property-value audits. - const propertyValueAudits = config['audits'].filter( ( audit ) => 'object' === typeof audit && term === audit[0]); + const propertyValueAudits = config[ 'audits' ].filter( + ( audit ) => 'object' === typeof audit && term === audit[ 0 ] + ); const propertyValueValues = ( () => { if ( propertyValueAudits.length > 0 ) { - return propertyValueAudits.flat().filter( item => 'property-values' !== item ); + return propertyValueAudits + .flat() + .filter( ( item ) => 'property-values' !== item ); } return []; - })(); + } )(); - if ( 'undefined' !== basicAudits[0] && term === basicAudits[0] ) { + if ( 'undefined' !== basicAudits[ 0 ] && term === basicAudits[ 0 ] ) { return true; } From b611af1295c6ce855d264d118f11ea30f84e480c Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 10 Dec 2020 17:24:40 -0500 Subject: [PATCH 34/47] fix: rm erroneous autofill --- css-audit.config.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/css-audit.config.js b/css-audit.config.js index 91f0c94..8059451 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -1,5 +1,3 @@ -const { truncateSync } = require( 'fs-extra' ); - module.exports = { format: 'html', filename: 'wp-admin', From 754c9e80c6bb99665232f80b5807c7e004812540 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 10 Dec 2020 17:48:39 -0500 Subject: [PATCH 35/47] fix: rm github workflows and test skip --- .github/workflows/node.yaml | 23 ----------------------- src/__tests__/colors.js | 2 +- 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 .github/workflows/node.yaml diff --git a/.github/workflows/node.yaml b/.github/workflows/node.yaml deleted file mode 100644 index d7ea5f0..0000000 --- a/.github/workflows/node.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Node.js CI - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [14.x] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm test - env: - CI: true \ No newline at end of file diff --git a/src/__tests__/colors.js b/src/__tests__/colors.js index 5355f3e..2e3dc4d 100644 --- a/src/__tests__/colors.js +++ b/src/__tests__/colors.js @@ -13,7 +13,7 @@ describe( 'Audit: Colors', () => { expect( value ).toBe( 0 ); } ); - it.skip( 'should ignore colors in non-color properties', () => { + it( 'should ignore colors in non-color properties', () => { const files = [ { name: 'a.css', From ce26910b9f6f7f49c9ef187ad62c1c605df7d4e6 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 17 Dec 2020 15:10:49 -0500 Subject: [PATCH 36/47] fix: return full object in json format for test --- src/__tests__/run.js | 2 +- src/formats/json.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/run.js b/src/__tests__/run.js index 44d8f91..e177608 100644 --- a/src/__tests__/run.js +++ b/src/__tests__/run.js @@ -2,7 +2,7 @@ const path = require( 'path' ); const { runAudits } = require( '../run' ); describe( 'Run the audits', () => { - it( 'runs with a configuration object', () => { + it( 'Run: Outputs JSON format from a configuration object', () => { // TODO: replace with cosmiconfig? const config = require( path.join( __dirname, diff --git a/src/formats/json.js b/src/formats/json.js index 0a369b5..404281e 100644 --- a/src/formats/json.js +++ b/src/formats/json.js @@ -5,5 +5,5 @@ * @return {string} reports as a JSON string. */ module.exports = function ( reports ) { - return JSON.stringify( reports.map( ( { results } ) => results ) ); + return JSON.stringify( reports.map( ( data ) => data ) ); }; From 3dcba210bd5c656865fa00cc8264a4224c9f6f34 Mon Sep 17 00:00:00 2001 From: laras126 Date: Thu, 17 Dec 2020 16:55:44 -0500 Subject: [PATCH 37/47] feat: add cosmiconfig --- package-lock.json | 224 +++++++++--------- package.json | 5 +- src/__tests__/run.js | 23 +- .../test.config.js} | 2 +- src/utils/cli.js | 25 +- 5 files changed, 137 insertions(+), 142 deletions(-) rename src/{utils/__tests__/fixtures/css-audit.config.js => __tests__/test.config.js} (98%) diff --git a/package-lock.json b/package-lock.json index 055ab62..5336b91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -571,6 +571,18 @@ "lodash": "^4.17.19", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + } + } } }, "@istanbuljs/load-nyc-config": { @@ -1029,10 +1041,16 @@ "uri-js": "^4.2.2" } }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==" + }, "ansi-escapes": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, "requires": { "type-fest": "^0.11.0" }, @@ -1040,7 +1058,8 @@ "type-fest": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==" + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true } } }, @@ -1455,11 +1474,6 @@ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" - }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -1495,14 +1509,6 @@ } } }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "requires": { - "restore-cursor": "^3.1.0" - } - }, "cli-table3": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.0.tgz", @@ -1513,11 +1519,6 @@ "string-width": "^4.2.0" } }, - "cli-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", - "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" - }, "cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -1901,6 +1902,14 @@ "once": "^1.4.0" } }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "requires": { + "ansi-colors": "^4.1.1" + } + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1995,8 +2004,8 @@ "@babel/code-frame": "^7.0.0", "@eslint/eslintrc": "^0.2.1", "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", @@ -2013,21 +2022,17 @@ "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", "is-glob": "^4.0.0", "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.14", + "levn": "^0.4.1", + "lodash": "^4.17.19", "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", - "optionator": "^0.8.3", + "optionator": "^0.9.1", "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", + "regexpp": "^3.1.0", + "strip-json-comments": "^3.1.0", "table": "^5.2.3", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" @@ -2100,6 +2105,70 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==" + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" + } + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } } } }, @@ -2204,16 +2273,6 @@ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" }, - "espree": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", - "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", - "requires": { - "acorn": "^7.1.1", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.3.0" - } - }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2428,16 +2487,6 @@ } } }, - "external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -2538,14 +2587,6 @@ "bser": "2.1.1" } }, - "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, "file-entry-cache": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", @@ -2920,6 +2961,7 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -2974,26 +3016,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "inquirer": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", - "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.19", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.6.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - } - }, "internal-slot": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.2.tgz", @@ -4115,7 +4137,8 @@ "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true }, "minimatch": { "version": "3.0.4", @@ -4164,11 +4187,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" - }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -4213,15 +4231,6 @@ "lower-case": "^1.1.1" } }, - "no-case": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", - "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", - "dev": true, - "requires": { - "lower-case": "^1.1.1" - } - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -4442,6 +4451,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, "requires": { "mimic-fn": "^2.1.0" } @@ -4912,15 +4922,6 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -4976,7 +4977,8 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true }, "sane": { "version": "4.1.0", @@ -5217,7 +5219,8 @@ "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true }, "sisteransi": { "version": "1.0.5", @@ -5777,11 +5780,6 @@ "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", "dev": true }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, "tinycolor2": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz", @@ -5796,14 +5794,6 @@ "os-tmpdir": "~1.0.2" } }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "requires": { - "os-tmpdir": "~1.0.2" - } - }, "tmpl": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", diff --git a/package.json b/package.json index 7b8949d..d09b498 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@wordpress/prettier-config": "0.4.0", "chalk": "4.1.0", "cli-table3": "0.6.0", + "cosmiconfig": "^7.0.0", "css-tree": "1.0.1", "cssom": "0.4.4", "eslint": "7.13.0", @@ -40,7 +41,9 @@ } }, "jest": { - "modulePathIgnorePatterns": ["fixtures"] + "modulePathIgnorePatterns": [ + "fixtures" + ] }, "prettier": "@wordpress/prettier-config", "devDependencies": { diff --git a/src/__tests__/run.js b/src/__tests__/run.js index e177608..c7fbe98 100644 --- a/src/__tests__/run.js +++ b/src/__tests__/run.js @@ -1,14 +1,23 @@ -const path = require( 'path' ); +const { cosmiconfigSync } = require( 'cosmiconfig' ); const { runAudits } = require( '../run' ); describe( 'Run the audits', () => { - it( 'Run: Outputs JSON format from a configuration object', () => { - // TODO: replace with cosmiconfig? - const config = require( path.join( - __dirname, - '../utils/__tests__/fixtures/css-audit.config.js' - ) ); + it( 'should output the JSON format from a configuration object', () => { + const config = ( () => { + const moduleName = 'test' === process.env ? 'test' : 'css-audit'; + + try { + const explorerSync = cosmiconfigSync( moduleName ); + const { config } = explorerSync.search(); + + return config; + } catch { + console.error( + "Can't find config file." + ); + } + } )(); const result = runAudits( [ { name: 'a.css', diff --git a/src/utils/__tests__/fixtures/css-audit.config.js b/src/__tests__/test.config.js similarity index 98% rename from src/utils/__tests__/fixtures/css-audit.config.js rename to src/__tests__/test.config.js index f69e62d..3e09c7b 100644 --- a/src/utils/__tests__/fixtures/css-audit.config.js +++ b/src/__tests__/test.config.js @@ -9,4 +9,4 @@ module.exports = { [ 'property-values', 'font-size' ], [ 'property-values', 'padding-top,padding-bottom' ], ], -}; \ No newline at end of file +}; diff --git a/src/utils/cli.js b/src/utils/cli.js index 0ba1fb8..95866eb 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -1,8 +1,8 @@ /** * External dependencies */ -const path = require( 'path' ); const minimist = require( 'minimist' ); +const { cosmiconfigSync } = require( 'cosmiconfig' ); const getArgsFromCLI = ( excludePrefixes ) => { const args = process.argv.slice( 2 ); @@ -28,18 +28,6 @@ const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; * @param {bool} cliOnly */ -// TODO: we can use cosmiconfig for this -const configPath = () => { - if ( 'test' === process.env.NODE_ENV ) { - return path.join( - __dirname, - '/__tests__/fixtures/css-audit.config.js' - ); - } - - return path.join( process.cwd(), 'css-audit.config.js' ); -}; - const getArg = ( arg, cliOnly = false ) => { for ( const cliArg of getArgsFromCLI() ) { const [ name, value ] = cliArg.split( '=' ); @@ -53,13 +41,18 @@ const getArg = ( arg, cliOnly = false ) => { return false; } - // TODO: replace with cosmiconfig. const config = ( () => { + + const moduleName = 'test' === process.env.NODE_ENV ? 'test' : 'css-audit'; + try { - return require( configPath() ); + const explorerSync = cosmiconfigSync( moduleName ); + const { config } = explorerSync.search(); + + return config; } catch { console.error( - "Can't find config file. \nMake sure there is css-audit.config.js in the directory where you run this command." + "Can't find config file." ); } } )(); From 0529d797defa084e57b58eff685ad79bbd3f8dde Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 6 Jan 2021 15:59:47 -0500 Subject: [PATCH 38/47] fix: issue with test config location --- .../__tests__/test-config.config.js} | 0 src/utils/cli.js | 21 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) rename src/{__tests__/test.config.js => utils/__tests__/test-config.config.js} (100%) diff --git a/src/__tests__/test.config.js b/src/utils/__tests__/test-config.config.js similarity index 100% rename from src/__tests__/test.config.js rename to src/utils/__tests__/test-config.config.js diff --git a/src/utils/cli.js b/src/utils/cli.js index 95866eb..945f0c4 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -2,7 +2,9 @@ * External dependencies */ const minimist = require( 'minimist' ); +const path = require( 'path' ); const { cosmiconfigSync } = require( 'cosmiconfig' ); +const { pathExists } = require('fs-extra'); const getArgsFromCLI = ( excludePrefixes ) => { const args = process.argv.slice( 2 ); @@ -43,16 +45,18 @@ const getArg = ( arg, cliOnly = false ) => { const config = ( () => { - const moduleName = 'test' === process.env.NODE_ENV ? 'test' : 'css-audit'; + const moduleName = 'test' === process.env.NODE_ENV ? 'test-config' : 'css-audit'; + const searchFrom = 'test' === process.env.NODE_ENV ? path.join( __dirname, '__tests__' ) : process.cwd(); - try { - const explorerSync = cosmiconfigSync( moduleName ); - const { config } = explorerSync.search(); + const explorerSync = cosmiconfigSync( moduleName ); + const { config } = explorerSync.search( searchFrom ); + try { return config; - } catch { + } catch( e ) { console.error( - "Can't find config file." + e, + "Error retrieving config file." ); } } )(); @@ -60,9 +64,9 @@ const getArg = ( arg, cliOnly = false ) => { const term = arg.substr( 2 ); // This is a simple property: value arg e.g. format: json - const argIsNotAnAudit = config.hasOwnProperty( term ); + const isSimplePropertyValueArg = config.hasOwnProperty( term ); - if ( argIsNotAnAudit ) { + if ( isSimplePropertyValueArg ) { return 'undefined' === typeof config[ term ] ? true : config[ term ] || null; @@ -78,6 +82,7 @@ const getArg = ( arg, cliOnly = false ) => { const propertyValueAudits = config[ 'audits' ].filter( ( audit ) => 'object' === typeof audit && term === audit[ 0 ] ); + const propertyValueValues = ( () => { if ( propertyValueAudits.length > 0 ) { return propertyValueAudits From 22bcaf588582a9f3a6545081878eabf2be486b72 Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 6 Jan 2021 16:04:32 -0500 Subject: [PATCH 39/47] fix: linter and format --- src/__tests__/run.js | 19 ++++++++----------- src/utils/__tests__/cli.js | 1 - src/utils/cli.js | 27 +++++++++++++-------------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/__tests__/run.js b/src/__tests__/run.js index c7fbe98..07eaf98 100644 --- a/src/__tests__/run.js +++ b/src/__tests__/run.js @@ -3,21 +3,18 @@ const { runAudits } = require( '../run' ); describe( 'Run the audits', () => { it( 'should output the JSON format from a configuration object', () => { - const config = ( () => { - - const moduleName = 'test' === process.env ? 'test' : 'css-audit'; + const configSrc = ( () => { + const moduleName = 'test'; + const explorerSync = cosmiconfigSync( moduleName ); + const { config } = explorerSync.search(); try { - const explorerSync = cosmiconfigSync( moduleName ); - const { config } = explorerSync.search(); - return config; - } catch { - console.error( - "Can't find config file." - ); + } catch ( e ) { + console.error( e, "Can't find config file." ); } } )(); + const result = runAudits( [ { name: 'a.css', @@ -25,7 +22,7 @@ describe( 'Run the audits', () => { }, ] ); - config.audits.forEach( ( audit ) => { + configSrc.audits.forEach( ( audit ) => { if ( Array.isArray( audit ) ) { audit[ 1 ].split( ',' ).forEach( ( property ) => { expect( result ).toContain( property ); diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 6322d6d..6b1131b 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,5 +1,4 @@ const { getArg, getArgsFromCLI } = require( '../cli' ); -const path = require( 'path' ); describe( 'Run Audits from CLI', () => { it( 'should get args from the CLI', () => { diff --git a/src/utils/cli.js b/src/utils/cli.js index 945f0c4..5cf4882 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -4,7 +4,6 @@ const minimist = require( 'minimist' ); const path = require( 'path' ); const { cosmiconfigSync } = require( 'cosmiconfig' ); -const { pathExists } = require('fs-extra'); const getArgsFromCLI = ( excludePrefixes ) => { const args = process.argv.slice( 2 ); @@ -27,7 +26,7 @@ const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; * config if its not present. * * @param {string} arg - * @param {bool} cliOnly + * @param {boolean} cliOnly */ const getArg = ( arg, cliOnly = false ) => { @@ -44,20 +43,20 @@ const getArg = ( arg, cliOnly = false ) => { } const config = ( () => { - - const moduleName = 'test' === process.env.NODE_ENV ? 'test-config' : 'css-audit'; - const searchFrom = 'test' === process.env.NODE_ENV ? path.join( __dirname, '__tests__' ) : process.cwd(); + const moduleName = + 'test' === process.env.NODE_ENV ? 'test-config' : 'css-audit'; + const searchFrom = + 'test' === process.env.NODE_ENV + ? path.join( __dirname, '__tests__' ) + : process.cwd(); const explorerSync = cosmiconfigSync( moduleName ); - const { config } = explorerSync.search( searchFrom ); + const { configSrc } = explorerSync.search( searchFrom ); try { - return config; - } catch( e ) { - console.error( - e, - "Error retrieving config file." - ); + return configSrc; + } catch ( e ) { + console.error( e, 'Error retrieving config file.' ); } } )(); @@ -74,12 +73,12 @@ const getArg = ( arg, cliOnly = false ) => { if ( config.hasOwnProperty( 'audits' ) ) { // Separate the basic audits from property-values. - const basicAudits = config[ 'audits' ].filter( + const basicAudits = config.audits.filter( ( audit ) => term === audit && 'string' === typeof audit ); // Create an array of values of the property-value audits. - const propertyValueAudits = config[ 'audits' ].filter( + const propertyValueAudits = config.audits.filter( ( audit ) => 'object' === typeof audit && term === audit[ 0 ] ); From f57cfebea63c2051c5012b34431bf8deae40344f Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 6 Jan 2021 16:12:51 -0500 Subject: [PATCH 40/47] feat: add more property value audits --- css-audit.config.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/css-audit.config.js b/css-audit.config.js index 8059451..401477e 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -8,5 +8,22 @@ module.exports = { 'property-values', 'padding-top,padding-bottom,padding-left,padding-right', ], + [ + 'property-values', + 'margin,margin-top,margin-bottom,margin-left,margin-right', + ], + [ 'property-values', 'width,min-width,max-width' ], + [ 'property-values', 'height,max-height,min-height' ], + [ 'property-values', 'top', 'bottom', 'right', 'left' ][ + ( 'property-values', 'z-index' ) + ], + [ + 'property-values', + 'font-size,font,line-height,font-family,letter-spacing', + ], + [ + 'property-values', + 'background-position,background-size,border,border-radius,bottom,box-shadow,clip,font,font-size,height,left,line-height,letter-spacing,margin,max-height,max-width,min-height,min-width,outline,outline-offset,padding,right,text-indent,text-shadow,top,transform,width', + ], ], }; From 14726f1037ffdaf9f36ab22a319f77e7c1d4bad4 Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 6 Jan 2021 16:26:13 -0500 Subject: [PATCH 41/47] fix: rename file --- .../{test-config.config.js => example-config.config.js} | 0 src/utils/cli.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/utils/__tests__/{test-config.config.js => example-config.config.js} (100%) diff --git a/src/utils/__tests__/test-config.config.js b/src/utils/__tests__/example-config.config.js similarity index 100% rename from src/utils/__tests__/test-config.config.js rename to src/utils/__tests__/example-config.config.js diff --git a/src/utils/cli.js b/src/utils/cli.js index 5cf4882..6148d1e 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -44,7 +44,7 @@ const getArg = ( arg, cliOnly = false ) => { const config = ( () => { const moduleName = - 'test' === process.env.NODE_ENV ? 'test-config' : 'css-audit'; + 'test' === process.env.NODE_ENV ? 'example-config' : 'css-audit'; const searchFrom = 'test' === process.env.NODE_ENV ? path.join( __dirname, '__tests__' ) From cb9737f831651f9006ee908737602a99fa0c5add Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 6 Jan 2021 16:57:02 -0500 Subject: [PATCH 42/47] fix: bugs --- package.json | 3 ++- src/__tests__/run.js | 14 ++----------- src/utils/__tests__/cli.js | 9 +++++++- src/utils/cli.js | 42 +++++++++++++++++++++++--------------- 4 files changed, 37 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index d09b498..5a466f4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ }, "jest": { "modulePathIgnorePatterns": [ - "fixtures" + "fixtures", + ".config.js" ] }, "prettier": "@wordpress/prettier-config", diff --git a/src/__tests__/run.js b/src/__tests__/run.js index 07eaf98..65f359d 100644 --- a/src/__tests__/run.js +++ b/src/__tests__/run.js @@ -1,19 +1,9 @@ -const { cosmiconfigSync } = require( 'cosmiconfig' ); const { runAudits } = require( '../run' ); +const { getConfig } = require( '../utils/cli' ); describe( 'Run the audits', () => { it( 'should output the JSON format from a configuration object', () => { - const configSrc = ( () => { - const moduleName = 'test'; - const explorerSync = cosmiconfigSync( moduleName ); - const { config } = explorerSync.search(); - - try { - return config; - } catch ( e ) { - console.error( e, "Can't find config file." ); - } - } )(); + const configSrc = getConfig( process.env.NODE_ENV ); const result = runAudits( [ { diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 6b1131b..02d4338 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -1,4 +1,4 @@ -const { getArg, getArgsFromCLI } = require( '../cli' ); +const { getArg, getArgsFromCLI, getConfig } = require( '../cli' ); describe( 'Run Audits from CLI', () => { it( 'should get args from the CLI', () => { @@ -62,3 +62,10 @@ describe( 'Run Audits from Config', () => { expect( getArg( '--nonexistant' ) ).toBe( false ); } ); } ); + + +describe( 'Configuration', () => { + it( 'should get configuration from a file', () => { + expect( typeof getConfig() ).toBe( 'object' ); + }) +}) \ No newline at end of file diff --git a/src/utils/cli.js b/src/utils/cli.js index 6148d1e..d026c99 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -19,6 +19,29 @@ const getArgsFromCLI = ( excludePrefixes ) => { const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; +/** + * Get configuration using cosmiconfig. + * + * @param {string} env + */ +const getConfig = ( env ) => { + const moduleName = + 'test' === env ? 'example-config' : 'css-audit'; + const searchFrom = + 'test' === env + ? path.join( __dirname, '__tests__' ) + : process.cwd(); + + const explorerSync = cosmiconfigSync( moduleName ); + const { config } = explorerSync.search( searchFrom ); + + try { + return config; + } catch ( e ) { + console.error( e, 'Error retrieving config file.' ); + } +}; + /** * Get the argument required for running the audit, * @@ -42,23 +65,7 @@ const getArg = ( arg, cliOnly = false ) => { return false; } - const config = ( () => { - const moduleName = - 'test' === process.env.NODE_ENV ? 'example-config' : 'css-audit'; - const searchFrom = - 'test' === process.env.NODE_ENV - ? path.join( __dirname, '__tests__' ) - : process.cwd(); - - const explorerSync = cosmiconfigSync( moduleName ); - const { configSrc } = explorerSync.search( searchFrom ); - - try { - return configSrc; - } catch ( e ) { - console.error( e, 'Error retrieving config file.' ); - } - } )(); + const config = getConfig( process.env.NODE_ENV ); const term = arg.substr( 2 ); @@ -124,5 +131,6 @@ module.exports = { getArgsFromCLI, getFileArgsFromCLI, getArg, + getConfig, getHelp, }; From f5baae45865dd42e9d44c51bd676b9de631c140a Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 6 Jan 2021 16:58:33 -0500 Subject: [PATCH 43/47] fix: format --- src/utils/__tests__/cli.js | 5 ++--- src/utils/cli.js | 7 ++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/utils/__tests__/cli.js b/src/utils/__tests__/cli.js index 02d4338..01e9e0e 100644 --- a/src/utils/__tests__/cli.js +++ b/src/utils/__tests__/cli.js @@ -63,9 +63,8 @@ describe( 'Run Audits from Config', () => { } ); } ); - describe( 'Configuration', () => { it( 'should get configuration from a file', () => { expect( typeof getConfig() ).toBe( 'object' ); - }) -}) \ No newline at end of file + } ); +} ); diff --git a/src/utils/cli.js b/src/utils/cli.js index d026c99..bd5b59d 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -25,12 +25,9 @@ const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._; * @param {string} env */ const getConfig = ( env ) => { - const moduleName = - 'test' === env ? 'example-config' : 'css-audit'; + const moduleName = 'test' === env ? 'example-config' : 'css-audit'; const searchFrom = - 'test' === env - ? path.join( __dirname, '__tests__' ) - : process.cwd(); + 'test' === env ? path.join( __dirname, '__tests__' ) : process.cwd(); const explorerSync = cosmiconfigSync( moduleName ); const { config } = explorerSync.search( searchFrom ); From 56cec528ce4372186909fd39e191855ee6c6434f Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 6 Jan 2021 17:16:41 -0500 Subject: [PATCH 44/47] doc: update readme --- README.md | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cb69e95..b9efd4c 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ To run this yourself, download or clone this repo, then install the dependencies $ git clone git@github.com:ryelle/css-audit.git $ cd css-audit $ npm install -$ npm run css-audit -``` +$ npm run css-audit -- +`` If you want to work on the audits yourself, [fork this repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) to your account first. You can submit issues or PRs. ## Running Audits -To run the audits, you need a list of CSS files, and to indicate which audits you want to run. `yarn` and `npm` both automatically expand globs (`folder/*`), so you can use that, or pass in a list of CSS files. The audits are described below. +To run the audits, you need a list of CSS files, and to indicate which audits you want to run. `yarn` and `npm` both automatically expand globs (`folder/*`), so you can use that, or pass in a list of CSS files. The audits are described below, and can be run via the following CLI args, or via configuration file (described in the next section). ``` $ npm run css-audit -- [options] @@ -35,6 +35,26 @@ Usage: css-audit -- [options] --help Show this message. ``` + +### Configuration File + +The program will prioritize configuration from CLI arguments, and will fallback to configuration stored in a file called `css-audit.config.js`. + +``` +module.exports = { + format: 'json', + audits: [ + 'colors', + 'important', + 'display-none', + 'selectors', + 'media-queries', + [ 'property-values', 'font-size' ], + [ 'property-values', 'padding-top,padding-bottom' ], + ], +}; +``` + ## Generating HTML Reports To generate an HTML report, use the `--format=html` option and specify a name for the file with the `--filename=name` option. This will output a `{name}.html` file in public/ that is viewable on Github Pages. @@ -45,6 +65,8 @@ For example, generating a report for wp-admin using the below strategy for pulli npm run css-audit -- v5.5/**/* --format=html --all --filename=wp-admin ``` +In the configuration file, the argument `filename` can be added as a simple property: value combination, the same as `format` in the example. + ## Getting core CSS files You can download the source files of CSS (not minified or RTL'd) from the svn repository. The following code will create a new directory, `v5.5`, and download just the files from each `css` folder. From accfad6e627b0c8912759bfc1e5e92b359a05224 Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 6 Jan 2021 17:22:16 -0500 Subject: [PATCH 45/47] fix: name change, build html --- public/wp-admin.html | 2942 +++++++++++++++++++++++++++++++++++------- src/utils/cli.js | 6 +- 2 files changed, 2490 insertions(+), 458 deletions(-) diff --git a/public/wp-admin.html b/public/wp-admin.html index e8e2f08..01f9de0 100644 --- a/public/wp-admin.html +++ b/public/wp-admin.html @@ -35,6 +35,41 @@

CSS Audit for wp-admin

Media Queries audit + +
  • + + Property Values: font-size, font-family, font-weight audit + +
  • +
  • + + Property Values: padding-top, padding-bottom, padding-left, padding-right audit + +
  • +
  • + + Property Values: margin, margin-top, margin-bottom, margin-left, margin-right audit + +
  • +
  • + + Property Values: width, min-width, max-width audit + +
  • +
  • + + Property Values: height, max-height, min-height audit + +
  • +
  • + + Property Values: font-size, font, line-height, font-family, letter-spacing audit + +
  • +
  • + + Property Values: background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width audit +
  • @@ -50,8 +85,8 @@

    -

    Number of unique colors: 177

    -

    Number of unique colors (ignoring opacity): 137

    +

    Number of unique colors: 178

    +

    Number of unique colors (ignoring opacity): 138

    List of all colors

      @@ -65,23 +100,28 @@

      List of all colors

      -
    • - #d1e4dd +
    • + #ebcd3d
    • -
    • - #000 +
    • + #b04329 +
    • + + +
    • + #f2edd4
    • -
    • - #eeeadd +
    • + #322d2b
    • -
    • - #767676 +
    • + #bd7331
    • @@ -265,18 +305,13 @@

      List of all colors

      -
    • - #007cba -
    • - - -
    • - #a00 +
    • + #000
    • -
    • - #fbfbfc +
    • + #007cba
    • @@ -375,6 +410,11 @@

      List of all colors

      +
    • + #a00 +
    • + +
    • #f5f5f5
    • @@ -525,6 +565,11 @@

      List of all colors

      +
    • + #fbfbfc +
    • + +
    • rgba(0,0,0,0.5)
    • @@ -635,11 +680,6 @@

      List of all colors

      -
    • - #39424a -
    • - -
    • #40860a
    • @@ -944,61 +984,61 @@

      Top 10 most-used colors

      • - 152 + 298 #fff
      • - 122 + 244 #ddd
      • - 66 + 132 #eee
      • - 50 + 100 #72777c
      • - 44 + 88 #0073aa
      • - 38 + 76 gray
      • - 33 + 66 #ccc
      • - 32 + 64 #555d66
      • - 30 + 60 rgba(0,0,0,0.1)
      • - 30 + 60 #32373c
      • @@ -1007,61 +1047,61 @@

        Top 10 least-used colors

        • - 1 + 2 rgba(0,115,170,.8)
        • - 1 + 2 rgba(238,238,238,0.9)
        • - 1 + 2 rgb(153,153,153)
        • - 1 + 2 rgba(153,153,153,0.1)
        • - 1 + 2 #d5d2ca
        • - 1 + 2 rgba(49,49,49,0.7)
        • - 1 + 2 rgba(0,0,0,0.05)
        • - 1 + 2 rgba(244,244,244,0.7)
        • - 1 + 2 rgba(255,255,255,0.65)
        • - 1 + 2 #826eb4
        • @@ -1074,149 +1114,239 @@

          -

          Number of times `!important` is used: 100

          +

          Number of times `!important` is used: 198

          Number of times `!important` is used per file

          1. 14 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css +
          2. + +
          3. + 14 + v5.5/includes/nav-menus.css +
          4. + +
          5. + 13 + v5.5/admin/common.css
          6. 13 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/themes.css
          7. 13 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/includes/common.css +
          8. + +
          9. + 13 + v5.5/includes/themes.css +
          10. + +
          11. + 12 + v5.5/admin/edit.css
          12. 12 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/includes/edit.css
          13. 9 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css +
          14. + +
          15. + 9 + v5.5/includes/list-tables.css +
          16. + +
          17. + 7 + v5.5/admin/customize-controls.css
          18. 7 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/includes/customize-controls.css
          19. 5 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
          20. 5 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + v5.5/admin/dashboard.css
          21. 5 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/includes/customize-nav-menus.css +
          22. + +
          23. + 5 + v5.5/includes/dashboard.css +
          24. + +
          25. + 4 + v5.5/admin/forms.css +
          26. + +
          27. + 4 + v5.5/includes/forms.css +
          28. + +
          29. + 3 + v5.5/admin/admin-menu.css
          30. 3 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/customize-widgets.css
          31. 3 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-widgets.css + v5.5/includes/admin-menu.css +
          32. + +
          33. + 3 + v5.5/includes/customize-widgets.css +
          34. + +
          35. + 2 + v5.5/admin/about.css
          36. 2 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/about.css + v5.5/admin/color-picker.css
          37. 2 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/color-picker.css + v5.5/admin/media.css
          38. 2 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/revisions.css
          39. 2 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/revisions.css + v5.5/includes/about.css +
          40. + +
          41. + 2 + v5.5/includes/color-picker.css +
          42. + +
          43. + 2 + v5.5/includes/media.css +
          44. + +
          45. + 2 + v5.5/includes/revisions.css +
          46. + +
          47. + 1 + v5.5/admin/install.css
          48. 1 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/install.css + v5.5/admin/l10n.css
          49. 1 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/l10n.css + v5.5/admin/login.css
          50. 1 - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/login.css + v5.5/includes/install.css +
          51. + +
          52. + 1 + v5.5/includes/l10n.css +
          53. + +
          54. + 1 + v5.5/includes/login.css

          Top properties that use !important

          1. - 15 + 28 display
          2. - 14 + 28 min-width
          3. - 7 + 14 text-decoration
          4. - 6 + 12 margin
          5. - 5 + 10 width
          6. - 5 + 10 font-size
          7. - 4 + 8 font
          8. - 4 + 8 padding
          9. - 3 + 6 word-wrap
          10. - 3 + 6 border
          11. @@ -1229,1441 +1359,3343 @@

            -

            Number of times `display: none` is used: 220

            +

            Number of times `display: none` is used: 438

            Places where `display: none` is used

            1. .about__container div.updated,.about__container div.error,.about__container .notice
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/about.css + v5.5/admin/about.css
            2. .about-wrap div.updated,.about-wrap div.error,.about-wrap .notice
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/about.css + v5.5/admin/about.css
            3. #adminmenu .wp-submenu-head
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            4. .wp-menu-arrow
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            5. .folded ul#adminmenu li:hover a.wp-has-current-submenu:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            6. #adminmenu li span.count-0
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            7. .folded #collapse-button .collapse-button-label
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            8. li#wp-admin-bar-menu-toggle
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            9. .customize-support #menu-appearance a[href="themes.php?page=custom-header"],.customize-support #menu-appearance a[href="themes.php?page=custom-background"]
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            10. .auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            11. .auto-fold #collapse-menu .collapse-button-label
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            12. .auto-fold #adminmenuback,.auto-fold #adminmenuwrap
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            13. .auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            14. #adminmenu .wp-submenu
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            15. .auto-fold #adminmenu .selected .wp-submenu:after,.auto-fold #adminmenu .wp-menu-open .wp-submenu:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            16. .auto-fold #adminmenu .opensub .wp-submenu
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            17. #adminmenu .wp-submenu .wp-submenu-head
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            18. #adminmenuwrap,#adminmenuback
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/admin-menu.css + v5.5/admin/admin-menu.css
            19. .wp-picker-container .hidden
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/color-picker.css + v5.5/admin/color-picker.css
            20. .inner-sidebar
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            21. .hidden,.js .closed .inside,.js .hide-if-js,.no-js .hide-if-no-js,.js.wp-core-ui .hide-if-js,.js .wp-core-ui .hide-if-js,.no-js.wp-core-ui .hide-if-no-js,.no-js .wp-core-ui .hide-if-no-js
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            22. .no-js .widefat thead .check-column input,.no-js .widefat tfoot .check-column input
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            23. .icon32
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            24. .approve,.unapproved .unapprove
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            25. .filter-drawer,.wp-filter .favorites-form
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            26. .wp-filter .button.clear-filters
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            27. .filtered-by
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            28. .filters-applied .filter-group,.filters-applied .filter-drawer .buttons,.filters-applied .filter-drawer br
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            29. .show-filters .favorites-form,.show-filters .content-filterable,.show-filters.filters-applied.loading-content .content-filterable,.loading-content .content-filterable,.error .content-filterable
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            30. .filter-count
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            31. ul#dismissed-updates
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            32. #screen-meta
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            33. .metabox-prefs label a
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            34. .help-tab-content
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            35. .lp-show-latest p
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            36. #plugin-information-title div.vignette
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            37. #plugin-information .fyi h3,#plugin-information .fyi small
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            38. .plugin-details-modal #TB_ajaxWindowTitle
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            39. .plugin-details-modal .tb-close-icon
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            40. [role="treeitem"][aria-expanded="false"]>ul
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            41. .tree-folder>li:last-child::after,.tree-folder li:last-child>.tree-folder::after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            42. .accordion-section-content
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            43. .cannot-expand .accordion-section-title:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            44. #collapse-menu,.post-format-select
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            45. #wpfooter
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            46. #comments-form .checkforspam
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            47. #screen-meta #contextual-help-back,#screen-meta .contextual-help-sidebar
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/common.css + v5.5/admin/common.css
            48. #customize-theme-controls .control-section-outer
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            49. body:not(.ready) #publish-settings,body.trashing #customize-save-button-wrapper .save,body.trashing #publish-settings
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            50. #sub-accordion-section-publish_settings .customize-section-description-container
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            51. #customize-controls .customize-info .accordion-section-title:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            52. #customize-controls .customize-info .customize-panel-description,#customize-controls .customize-info .customize-section-description,#customize-outer-theme-controls .customize-info .customize-section-description,#customize-controls .no-widget-areas-rendered-notice
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            53. .accordion-sub-container.control-panel-content
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            54. .ios .customize-panel-back
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            55. .wp-full-overlay.collapsed #customize-controls #customize-notifications-area
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            56. .customize-control .dropdown-status
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            57. .customize-control-header .inner
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            58. #customize-theme-controls .control-panel-themes>.accordion-section-title:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            59. .in-themes-panel.animating .control-panel-themes .filter-themes-count
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            60. .themes-filter-bar .feature-filter-toggle .filter-count-filters
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            61. .customize-themes-full-container .customize-themes-section
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            62. .customize-themes-section .no-themes,.customize-themes-section .no-themes-local
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            63. .themes-section-installed_themes .theme .notice-success:not(.updated-message)
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            64. .control-panel-themes .customize-themes-mobile-back
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            65. .control-panel-themes .customize-themes-full-container
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            66. .showing-themes #customize-header-actions
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            67. .wp-customizer .theme-overlay
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            68. .reorder-done,.reordering .reorder
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            69. #available-widgets .customize-section-title,#available-menu-items .customize-section-title
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            70. #available-widgets-filter input::-ms-clear,#available-menu-items-search input::-ms-clear
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            71. #available-widgets-filter .clear-results,#available-menu-items-search .clear-results,#available-menu-items-search.loading .clear-results.is-visible
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            72. .no-widgets-found-message
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            73. #available-widgets .widget-tpl,#available-menu-items .item-tpl
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            74. .customize-controls-preview-toggle
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            75. #customize-footer-actions,.customize-controls-preview-toggle .controls,.preview-only .wp-full-overlay-sidebar-content,.preview-only .customize-controls-preview-toggle .preview
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + v5.5/admin/customize-controls.css
            76. .menu-item-reorder-nav
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            77. .reordering .menu-item .item-controls,.reordering .menu-item .item-type
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            78. .wp-customizer #screen-options-wrap
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            79. .control-section-nav_menu .field-link-target,.control-section-nav_menu .field-title-attribute,.control-section-nav_menu .field-css-classes,.control-section-nav_menu .field-xfn,.control-section-nav_menu .field-description
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            80. .menu-item-bar .item-delete
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            81. .adding-menu-items .menu-item-bar .item-edit
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            82. #available-menu-items .accordion-section-title .no-items,#available-menu-items .cannot-expand .accordion-section-title .spinner,#available-menu-items .cannot-expand .accordion-section-title>button
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            83. #available-menu-items-search .accordion-section-title:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            84. .menu-item-handle .spinner
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            85. li.assigned-to-menu-location .menu-delete-item
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-nav-menus.css + v5.5/admin/customize-nav-menus.css
            86. .control-section.control-section-sidebar,.customize-control-sidebar_widgets label,.customize-control-sidebar_widgets .hide-if-js
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-widgets.css + v5.5/admin/customize-widgets.css
            87. .customize-control-widget_form .widget-control-save
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-widgets.css + v5.5/admin/customize-widgets.css
            88. #widget-customizer-control-templates
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-widgets.css + v5.5/admin/customize-widgets.css
            89. #customize-theme-controls .widget-reorder-nav
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-widgets.css + v5.5/admin/customize-widgets.css
            90. #customize-theme-controls .move-widget-area
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-widgets.css + v5.5/admin/customize-widgets.css
            91. #customize-theme-controls .widget-area-select li:before
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-widgets.css + v5.5/admin/customize-widgets.css
            92. #customize-theme-controls .reordering .widget-title-action
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-widgets.css + v5.5/admin/customize-widgets.css
            93. #available-widgets .widget-action
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-widgets.css + v5.5/admin/customize-widgets.css
            94. #dashboard-widgets .postbox-container .empty-container:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + v5.5/admin/dashboard.css
            95. .community-events-errors[aria-hidden="true"],.community-events-errors [aria-hidden="true"],.community-events-loading[aria-hidden="true"],.community-events[aria-hidden="true"],.community-events [aria-hidden="true"]
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + v5.5/admin/dashboard.css
            96. .event-icon
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + v5.5/admin/dashboard.css
            97. .postbox .button-link .edit-box
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + v5.5/admin/dashboard.css
            98. #dashboard-widgets #postbox-container-3 .empty-container:after,#dashboard-widgets #postbox-container-4 .empty-container:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + v5.5/admin/dashboard.css
            99. .columns-prefs .columns-prefs-3,.columns-prefs .columns-prefs-4
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + v5.5/admin/dashboard.css
            100. #dashboard-widgets #postbox-container-4 .empty-container:after
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + v5.5/admin/dashboard.css
            101. #library-form .progress,#gallery-form .progress,.insert-gallery,.describe.startopen,.describe.startclosed
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/deprecated-media.css + v5.5/admin/deprecated-media.css
            102. #media-upload .del-attachment
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/deprecated-media.css + v5.5/admin/deprecated-media.css
            103. tr.not-image
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/deprecated-media.css + v5.5/admin/deprecated-media.css
            104. table.not-image tr.image-only
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/deprecated-media.css + v5.5/admin/deprecated-media.css
            105. #editable-post-name-full
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            106. body.post-new-php .submitbox .submitdelete
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            107. .no-js .category-tabs li.hide-if-no-js
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            108. .wp-hidden-children .wp-hidden-child,.ui-tabs-hide
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            109. .wp-editor-expand #content-resize-handle
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            110. .mce-fullscreen #wp-content-wrap .mce-tinymce .mce-wp-dfw
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            111. .post-php.mce-fullscreen #wpadminbar,.mce-fullscreen #wp-content-wrap .mce-wp-dfw
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            112. .tagchecklist br
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            113. .privacy-text-actions .success
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            114. .hide-privacy-policy-tutorial .wp-policy-help,.hide-privacy-policy-tutorial .privacy-policy-tutorial
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            115. .no-js #postcustomstuff #enternew
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            116. #select-featured-image .remove
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            117. .no-js #select-featured-image .choose
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            118. div.tabs-panel-inactive
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            119. .ac_results
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            120. #qt_content_dfw
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            121. .post-type-attachment .screen-layout,.post-type-attachment .columns-prefs
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            122. .screen-layout,.columns-prefs
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            123. #content_wp_fullscreen
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css -
            124. - -
            125. - .edit-term-notes
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + v5.5/admin/edit.css
            126. input[type="search"]::-webkit-search-decoration
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            127. .wp-core-ui select::-ms-expand
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            128. .wp-cancel-pw .dashicons-no
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            129. .pw-weak
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            130. .wp-pwd input::-ms-reveal
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            131. #pass1-text,.show-password #pass1
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            132. #pass1-text::-ms-clear
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            133. .request-filesystem-credentials-dialog
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            134. #request-filesystem-credentials-form .cancel-button
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            135. .wp-pwd .button .text
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/forms.css + v5.5/admin/forms.css
            136. .button.hide-if-no-js,.hide-if-no-js
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/install.css + v5.5/admin/install.css
            137. .column-response .post-com-count-no-pending,.column-comments .post-com-count-no-pending
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            138. .fixed .column-comment .comment-author
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            139. .wp-list-table .toggle-row
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            140. .locked-indicator
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            141. .locked-info
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            142. tr.wp-locked .check-column label,tr.wp-locked .check-column input[type="checkbox"],tr.wp-locked .row-actions .inline,tr.wp-locked .row-actions .trash
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            143. .tablenav .no-pages,.tablenav .one-page .pagination-links
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            144. .plugin-card-update-failed .plugin-card-bottom
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            145. .tablenav br
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            146. .tablenav.top .actions,.tablenav .view-switch
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            147. .tablenav.top .displaying-num
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            148. .tablenav.top .tablenav-pages.one-page
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            149. .form-wrap>p
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            150. .wp-list-table th.column-primary~th,.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary~td:not(.check-column)
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            151. #comments-form .fixed .column-author,#commentsdiv .fixed .column-author
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            152. .fixed .column-author.hidden~.column-comment .comment-author
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            153. .column-response .post-com-count [aria-hidden="true"],.column-comments .post-com-count [aria-hidden="true"]
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            154. .comments-box .toggle-row,.wp-list-table.plugins .toggle-row
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            155. #wpbody-content .wp-list-table.plugins .desc.hidden
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            156. table.plugin-install th.column-name,table.plugin-install th.column-version,table.plugin-install th.column-rating,table.plugin-install th.column-description
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/list-tables.css + v5.5/admin/list-tables.css
            157. .login .input::-ms-clear
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/login.css + v5.5/admin/login.css
            158. .no-js .hide-if-no-js
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/login.css + v5.5/admin/login.css
            159. input::-ms-reveal
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/login.css + v5.5/admin/login.css
            160. #wpbody-content #async-upload-wrap a
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            161. .media-item .describe-toggle-off,.media-item.open .describe-toggle-on
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            162. .media-item .startopen,.media-item .startclosed
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            163. .js .html-uploader #plupload-upload-ui
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            164. .drag-drop-inside p
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            165. .media-frame.mode-grid .media-frame-title,.media-frame.mode-grid .media-frame-router,.media-frame.mode-grid .media-frame-menu
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            166. .upload-php .mode-grid .hide-sidebar .media-sidebar
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            167. .upload-php .mode-grid .media-sidebar .media-uploader-status.errors h2
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            168. .imgedit-wait
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            169. .no-js .wp_attachment_image .button
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            170. .imgedit-help
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/media.css + v5.5/admin/media.css
            171. .has-no-menu-item .button-controls
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            172. .metabox-holder-disabled .button-controls .select-all
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            173. .hide-all
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            174. .nav-menus-php .list-wrap
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            175. .nav-menus-php .list li
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            176. .no-js .menu-item-edit-active .item-edit
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            177. .menu-item .menu-item-transport:empty
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            178. .no-js.nav-menus-php .item-edit:before
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            179. .menu-instructions-inactive
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            180. .menu-item-settings .field-move .button-link
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            181. .menu-item-edit-inactive .menu-item-settings
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            182. .hidden-field
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/nav-menus.css + v5.5/admin/nav-menus.css
            183. .revisions .diff-error
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/revisions.css + v5.5/admin/revisions.css
            184. .comparing-two-revisions .revisions-previous,.comparing-two-revisions .revisions-next,.revisions-meta .diff-meta-to strong
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/revisions.css + v5.5/admin/revisions.css
            185. .diff-meta-from
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/revisions.css + v5.5/admin/revisions.css
            186. .revisions-tooltip
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/revisions.css + v5.5/admin/revisions.css
            187. .revisions.pinned .revisions-tooltip
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/revisions.css + v5.5/admin/revisions.css
            188. .revisions-tooltip
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/revisions.css + v5.5/admin/revisions.css
            189. .site-status-has-issues.hide
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/site-health.css + v5.5/admin/site-health.css
            190. .site-status-all-clear.hide
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/site-health.css + v5.5/admin/site-health.css
            191. .health-check-accordion-panel[hidden]
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/site-health.css + v5.5/admin/site-health.css
            192. body.js .theme-browser.search-loading
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            193. .theme-browser .theme .theme-author
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            194. .customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-header"],.customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-background"]
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            195. .theme-overlay .theme-actions .active-theme,.theme-overlay.active .theme-actions .inactive-theme
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            196. .single-theme .theme-overlay .theme-backdrop,.single-theme .theme-overlay .theme-header,.single-theme .theme
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            197. .theme-browser .theme.active .theme-name span
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            198. .theme:not(.active):hover .theme-actions,.theme:not(.active):focus .theme-actions,.theme:hover .more-details,.theme:focus .more-details
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            199. .single-theme .current-label
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            200. .upload-view-toggle .browse,.plugin-install-tab-upload .upload-view-toggle .upload
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            201. .upload-theme,.upload-plugin
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            202. p.no-themes,p.no-themes-local
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            203. .theme-install-php .add-new-theme
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            204. .wp-full-overlay.collapsed .collapse-sidebar-label
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            205. .wp-full-overlay-footer .devices
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            206. .collapsed .wp-full-overlay-footer .devices button:before
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            207. .no-customize-support .hide-if-no-customize,.customize-support .hide-if-customize,.no-customize-support.wp-core-ui .hide-if-no-customize,.no-customize-support .wp-core-ui .hide-if-no-customize,.customize-support.wp-core-ui .hide-if-customize,.customize-support .wp-core-ui .hide-if-customize
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            208. #customize-container
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            209. .theme-install-overlay
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            210. .install-theme-info
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/themes.css + v5.5/admin/themes.css
            211. .widget.widget-dirty .widget-control-close-wrapper
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            212. .wp-core-ui .media-widget-control.selected .placeholder,.wp-core-ui .media-widget-control.selected .not-selected,.wp-core-ui .media-widget-control .selected
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            213. .media-frame.media-widget .image-details .embed-media-settings .setting.align,.media-frame.media-widget .attachment-display-settings .setting.align,.media-frame.media-widget .embed-media-settings .setting.align,.media-frame.media-widget .embed-media-settings .legend-inline,.media-frame.media-widget .embed-link-settings .setting.link-text,.media-frame.media-widget .replace-attachment,.media-frame.media-widget .checkbox-setting.autoplay
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            214. #widgets-left .sidebar-name .toggle-indicator
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            215. #available-widgets .widget-control-edit .edit,#available-widgets .widget-action .edit,#widgets-left .inactive-sidebar .widget-control-edit .add,#widgets-left .inactive-sidebar .widget-action .add,#widgets-right .widget-control-edit .add,#widgets-right .widget-action .add
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            216. .js .widgets-holder-wrap.closed .widget,.js .widgets-holder-wrap.closed .sidebar-description,.js .widgets-holder-wrap.closed .remove-inactive-widgets,.js .widgets-holder-wrap.closed .description,.js .closed br.clear
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            217. .widget-inside,.widget-description
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            218. #removing-widget
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            219. .widget-control-noform,#access-off,.widgets_access .widget-action,.widgets_access .handlediv,.widgets_access #access-on,.widgets_access .widget-holder .description,.no-js .widget-holder .description
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            220. .widgets-chooser
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            221. .text-widget-fields [hidden]
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/widgets.css + v5.5/admin/widgets.css
            222. -
            - -
            -
            -

            - Selectors audit -

            - -
            -

            Total number of selectors: 6552

            -

            Number of selectors with IDs: 2016

            -

            Top 10 selectors with the highest specificity

            -
              - +
            1. - #wpadminbar>#wp-toolbar>#wp-admin-bar-top-secondary>#wp-admin-bar-search #adminbarsearch input.adminbar-input:focus
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/colors/_admin.scss + .about__container div.updated,.about__container div.error,.about__container .notice
              + v5.5/includes/about.css
            2. - #side-sortables #postcustom #postcustomstuff #the-list textarea
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + .about-wrap div.updated,.about-wrap div.error,.about-wrap .notice
              + v5.5/includes/about.css
            3. - #dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + #adminmenu .wp-submenu-head
              + v5.5/includes/admin-menu.css
            4. - #wpbody #wpbody-content #dashboard-widgets.columns-1 .postbox-container
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/dashboard.css + .wp-menu-arrow
              + v5.5/includes/admin-menu.css
            5. - .post-type-attachment #wpbody-content #post-body.columns-2 #postbox-container-1
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + .folded ul#adminmenu li:hover a.wp-has-current-submenu:after
              + v5.5/includes/admin-menu.css
            6. - .post-type-attachment #poststuff #postbox-container-1 #side-sortables:empty
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + #adminmenu li span.count-0
              + v5.5/includes/admin-menu.css
            7. - .post-type-attachment #poststuff #post-body.columns-2 #side-sortables
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + .folded #collapse-button .collapse-button-label
              + v5.5/includes/admin-menu.css
            8. - .is-dragging-metaboxes #poststuff #postbox-container-1 #side-sortables:empty
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + li#wp-admin-bar-menu-toggle
              + v5.5/includes/admin-menu.css
            9. - .is-dragging-metaboxes #poststuff #post-body.columns-2 #side-sortables
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + .customize-support #menu-appearance a[href="themes.php?page=custom-header"],.customize-support #menu-appearance a[href="themes.php?page=custom-background"]
              + v5.5/includes/admin-menu.css
            10. - #side-sortables #postcustom #postcustomstuff td.left input
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + .auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after
              + v5.5/includes/admin-menu.css
            11. -
            -

            Top 10 selectors by length

            -
              - +
            1. - .policy-text div>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)+*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + .auto-fold #collapse-menu .collapse-button-label
              + v5.5/includes/admin-menu.css
            2. - .policy-text>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)+*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + .auto-fold #adminmenuback,.auto-fold #adminmenuwrap
              + v5.5/includes/admin-menu.css
            3. - #customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .customize-changeset-locked-message
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + .auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after
              + v5.5/includes/admin-menu.css
            4. - .hide-privacy-policy-tutorial>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + #adminmenu .wp-submenu
              + v5.5/includes/admin-menu.css
            5. - #customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .currently-editing
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + .auto-fold #adminmenu .selected .wp-submenu:after,.auto-fold #adminmenu .wp-menu-open .wp-submenu:after
              + v5.5/includes/admin-menu.css
            6. - .policy-text div>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + .auto-fold #adminmenu .opensub .wp-submenu
              + v5.5/includes/admin-menu.css
            7. - #customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .action-buttons
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + #adminmenu .wp-submenu .wp-submenu-head
              + v5.5/includes/admin-menu.css
            8. - .customize-section-description-container+#customize-control-custom_css:last-child .customize-control-notifications-container
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + #adminmenuwrap,#adminmenuback
              + v5.5/includes/admin-menu.css
            9. - .policy-text>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/edit.css + .wp-picker-container .hidden
              + v5.5/includes/color-picker.css
            10. - #customize-controls .customize-section-title>.customize-control-notifications-container:not(.has-overlay-notifications)
              - ../develop.svn.wordpress.org/trunk/src/wp-admin/css/customize-controls.css + .inner-sidebar
              + v5.5/includes/common.css
            11. -
            -
            -
            -
            -

            - Media Queries audit -

            - -
            -

            Number of total media queries: 145

            -

            Number of seemingly-unique media queries: 72

            -

            Top 10 most-used media queries

            -
              -
            1. - 23 - screen and (max-width:782px) + +
            2. + .hidden,.js .closed .inside,.js .hide-if-js,.no-js .hide-if-no-js,.js.wp-core-ui .hide-if-js,.js .wp-core-ui .hide-if-js,.no-js.wp-core-ui .hide-if-no-js,.no-js .wp-core-ui .hide-if-no-js
              + v5.5/includes/common.css
            3. - -
            4. - 8 - screen and (max-width:600px) + +
            5. + .no-js .widefat thead .check-column input,.no-js .widefat tfoot .check-column input
              + v5.5/includes/common.css
            6. - -
            7. - 8 - print + +
            8. + .icon32
              + v5.5/includes/common.css
            9. - -
            10. + +
            11. + .approve,.unapproved .unapprove
              + v5.5/includes/common.css +
            12. + +
            13. + .filter-drawer,.wp-filter .favorites-form
              + v5.5/includes/common.css +
            14. + +
            15. + .wp-filter .button.clear-filters
              + v5.5/includes/common.css +
            16. + +
            17. + .filtered-by
              + v5.5/includes/common.css +
            18. + +
            19. + .filters-applied .filter-group,.filters-applied .filter-drawer .buttons,.filters-applied .filter-drawer br
              + v5.5/includes/common.css +
            20. + +
            21. + .show-filters .favorites-form,.show-filters .content-filterable,.show-filters.filters-applied.loading-content .content-filterable,.loading-content .content-filterable,.error .content-filterable
              + v5.5/includes/common.css +
            22. + +
            23. + .filter-count
              + v5.5/includes/common.css +
            24. + +
            25. + ul#dismissed-updates
              + v5.5/includes/common.css +
            26. + +
            27. + #screen-meta
              + v5.5/includes/common.css +
            28. + +
            29. + .metabox-prefs label a
              + v5.5/includes/common.css +
            30. + +
            31. + .help-tab-content
              + v5.5/includes/common.css +
            32. + +
            33. + .lp-show-latest p
              + v5.5/includes/common.css +
            34. + +
            35. + #plugin-information-title div.vignette
              + v5.5/includes/common.css +
            36. + +
            37. + #plugin-information .fyi h3,#plugin-information .fyi small
              + v5.5/includes/common.css +
            38. + +
            39. + .plugin-details-modal #TB_ajaxWindowTitle
              + v5.5/includes/common.css +
            40. + +
            41. + .plugin-details-modal .tb-close-icon
              + v5.5/includes/common.css +
            42. + +
            43. + [role="treeitem"][aria-expanded="false"]>ul
              + v5.5/includes/common.css +
            44. + +
            45. + .tree-folder>li:last-child::after,.tree-folder li:last-child>.tree-folder::after
              + v5.5/includes/common.css +
            46. + +
            47. + .accordion-section-content
              + v5.5/includes/common.css +
            48. + +
            49. + .cannot-expand .accordion-section-title:after
              + v5.5/includes/common.css +
            50. + +
            51. + #collapse-menu,.post-format-select
              + v5.5/includes/common.css +
            52. + +
            53. + #wpfooter
              + v5.5/includes/common.css +
            54. + +
            55. + #comments-form .checkforspam
              + v5.5/includes/common.css +
            56. + +
            57. + #screen-meta #contextual-help-back,#screen-meta .contextual-help-sidebar
              + v5.5/includes/common.css +
            58. + +
            59. + #customize-theme-controls .control-section-outer
              + v5.5/includes/customize-controls.css +
            60. + +
            61. + body:not(.ready) #publish-settings,body.trashing #customize-save-button-wrapper .save,body.trashing #publish-settings
              + v5.5/includes/customize-controls.css +
            62. + +
            63. + #sub-accordion-section-publish_settings .customize-section-description-container
              + v5.5/includes/customize-controls.css +
            64. + +
            65. + #customize-controls .customize-info .accordion-section-title:after
              + v5.5/includes/customize-controls.css +
            66. + +
            67. + #customize-controls .customize-info .customize-panel-description,#customize-controls .customize-info .customize-section-description,#customize-outer-theme-controls .customize-info .customize-section-description,#customize-controls .no-widget-areas-rendered-notice
              + v5.5/includes/customize-controls.css +
            68. + +
            69. + .accordion-sub-container.control-panel-content
              + v5.5/includes/customize-controls.css +
            70. + +
            71. + .ios .customize-panel-back
              + v5.5/includes/customize-controls.css +
            72. + +
            73. + .wp-full-overlay.collapsed #customize-controls #customize-notifications-area
              + v5.5/includes/customize-controls.css +
            74. + +
            75. + .customize-control .dropdown-status
              + v5.5/includes/customize-controls.css +
            76. + +
            77. + .customize-control-header .inner
              + v5.5/includes/customize-controls.css +
            78. + +
            79. + #customize-theme-controls .control-panel-themes>.accordion-section-title:after
              + v5.5/includes/customize-controls.css +
            80. + +
            81. + .in-themes-panel.animating .control-panel-themes .filter-themes-count
              + v5.5/includes/customize-controls.css +
            82. + +
            83. + .themes-filter-bar .feature-filter-toggle .filter-count-filters
              + v5.5/includes/customize-controls.css +
            84. + +
            85. + .customize-themes-full-container .customize-themes-section
              + v5.5/includes/customize-controls.css +
            86. + +
            87. + .customize-themes-section .no-themes,.customize-themes-section .no-themes-local
              + v5.5/includes/customize-controls.css +
            88. + +
            89. + .themes-section-installed_themes .theme .notice-success:not(.updated-message)
              + v5.5/includes/customize-controls.css +
            90. + +
            91. + .control-panel-themes .customize-themes-mobile-back
              + v5.5/includes/customize-controls.css +
            92. + +
            93. + .control-panel-themes .customize-themes-full-container
              + v5.5/includes/customize-controls.css +
            94. + +
            95. + .showing-themes #customize-header-actions
              + v5.5/includes/customize-controls.css +
            96. + +
            97. + .wp-customizer .theme-overlay
              + v5.5/includes/customize-controls.css +
            98. + +
            99. + .reorder-done,.reordering .reorder
              + v5.5/includes/customize-controls.css +
            100. + +
            101. + #available-widgets .customize-section-title,#available-menu-items .customize-section-title
              + v5.5/includes/customize-controls.css +
            102. + +
            103. + #available-widgets-filter input::-ms-clear,#available-menu-items-search input::-ms-clear
              + v5.5/includes/customize-controls.css +
            104. + +
            105. + #available-widgets-filter .clear-results,#available-menu-items-search .clear-results,#available-menu-items-search.loading .clear-results.is-visible
              + v5.5/includes/customize-controls.css +
            106. + +
            107. + .no-widgets-found-message
              + v5.5/includes/customize-controls.css +
            108. + +
            109. + #available-widgets .widget-tpl,#available-menu-items .item-tpl
              + v5.5/includes/customize-controls.css +
            110. + +
            111. + .customize-controls-preview-toggle
              + v5.5/includes/customize-controls.css +
            112. + +
            113. + #customize-footer-actions,.customize-controls-preview-toggle .controls,.preview-only .wp-full-overlay-sidebar-content,.preview-only .customize-controls-preview-toggle .preview
              + v5.5/includes/customize-controls.css +
            114. + +
            115. + .menu-item-reorder-nav
              + v5.5/includes/customize-nav-menus.css +
            116. + +
            117. + .reordering .menu-item .item-controls,.reordering .menu-item .item-type
              + v5.5/includes/customize-nav-menus.css +
            118. + +
            119. + .wp-customizer #screen-options-wrap
              + v5.5/includes/customize-nav-menus.css +
            120. + +
            121. + .control-section-nav_menu .field-link-target,.control-section-nav_menu .field-title-attribute,.control-section-nav_menu .field-css-classes,.control-section-nav_menu .field-xfn,.control-section-nav_menu .field-description
              + v5.5/includes/customize-nav-menus.css +
            122. + +
            123. + .menu-item-bar .item-delete
              + v5.5/includes/customize-nav-menus.css +
            124. + +
            125. + .adding-menu-items .menu-item-bar .item-edit
              + v5.5/includes/customize-nav-menus.css +
            126. + +
            127. + #available-menu-items .accordion-section-title .no-items,#available-menu-items .cannot-expand .accordion-section-title .spinner,#available-menu-items .cannot-expand .accordion-section-title>button
              + v5.5/includes/customize-nav-menus.css +
            128. + +
            129. + #available-menu-items-search .accordion-section-title:after
              + v5.5/includes/customize-nav-menus.css +
            130. + +
            131. + .menu-item-handle .spinner
              + v5.5/includes/customize-nav-menus.css +
            132. + +
            133. + li.assigned-to-menu-location .menu-delete-item
              + v5.5/includes/customize-nav-menus.css +
            134. + +
            135. + .control-section.control-section-sidebar,.customize-control-sidebar_widgets label,.customize-control-sidebar_widgets .hide-if-js
              + v5.5/includes/customize-widgets.css +
            136. + +
            137. + .customize-control-widget_form .widget-control-save
              + v5.5/includes/customize-widgets.css +
            138. + +
            139. + #widget-customizer-control-templates
              + v5.5/includes/customize-widgets.css +
            140. + +
            141. + #customize-theme-controls .widget-reorder-nav
              + v5.5/includes/customize-widgets.css +
            142. + +
            143. + #customize-theme-controls .move-widget-area
              + v5.5/includes/customize-widgets.css +
            144. + +
            145. + #customize-theme-controls .widget-area-select li:before
              + v5.5/includes/customize-widgets.css +
            146. + +
            147. + #customize-theme-controls .reordering .widget-title-action
              + v5.5/includes/customize-widgets.css +
            148. + +
            149. + #available-widgets .widget-action
              + v5.5/includes/customize-widgets.css +
            150. + +
            151. + #dashboard-widgets .postbox-container .empty-container:after
              + v5.5/includes/dashboard.css +
            152. + +
            153. + .community-events-errors[aria-hidden="true"],.community-events-errors [aria-hidden="true"],.community-events-loading[aria-hidden="true"],.community-events[aria-hidden="true"],.community-events [aria-hidden="true"]
              + v5.5/includes/dashboard.css +
            154. + +
            155. + .event-icon
              + v5.5/includes/dashboard.css +
            156. + +
            157. + .postbox .button-link .edit-box
              + v5.5/includes/dashboard.css +
            158. + +
            159. + #dashboard-widgets #postbox-container-3 .empty-container:after,#dashboard-widgets #postbox-container-4 .empty-container:after
              + v5.5/includes/dashboard.css +
            160. + +
            161. + .columns-prefs .columns-prefs-3,.columns-prefs .columns-prefs-4
              + v5.5/includes/dashboard.css +
            162. + +
            163. + #dashboard-widgets #postbox-container-4 .empty-container:after
              + v5.5/includes/dashboard.css +
            164. + +
            165. + #library-form .progress,#gallery-form .progress,.insert-gallery,.describe.startopen,.describe.startclosed
              + v5.5/includes/deprecated-media.css +
            166. + +
            167. + #media-upload .del-attachment
              + v5.5/includes/deprecated-media.css +
            168. + +
            169. + tr.not-image
              + v5.5/includes/deprecated-media.css +
            170. + +
            171. + table.not-image tr.image-only
              + v5.5/includes/deprecated-media.css +
            172. + +
            173. + #editable-post-name-full
              + v5.5/includes/edit.css +
            174. + +
            175. + body.post-new-php .submitbox .submitdelete
              + v5.5/includes/edit.css +
            176. + +
            177. + .no-js .category-tabs li.hide-if-no-js
              + v5.5/includes/edit.css +
            178. + +
            179. + .wp-hidden-children .wp-hidden-child,.ui-tabs-hide
              + v5.5/includes/edit.css +
            180. + +
            181. + .wp-editor-expand #content-resize-handle
              + v5.5/includes/edit.css +
            182. + +
            183. + .mce-fullscreen #wp-content-wrap .mce-tinymce .mce-wp-dfw
              + v5.5/includes/edit.css +
            184. + +
            185. + .post-php.mce-fullscreen #wpadminbar,.mce-fullscreen #wp-content-wrap .mce-wp-dfw
              + v5.5/includes/edit.css +
            186. + +
            187. + .tagchecklist br
              + v5.5/includes/edit.css +
            188. + +
            189. + .privacy-text-actions .success
              + v5.5/includes/edit.css +
            190. + +
            191. + .hide-privacy-policy-tutorial .wp-policy-help,.hide-privacy-policy-tutorial .privacy-policy-tutorial
              + v5.5/includes/edit.css +
            192. + +
            193. + .no-js #postcustomstuff #enternew
              + v5.5/includes/edit.css +
            194. + +
            195. + #select-featured-image .remove
              + v5.5/includes/edit.css +
            196. + +
            197. + .no-js #select-featured-image .choose
              + v5.5/includes/edit.css +
            198. + +
            199. + div.tabs-panel-inactive
              + v5.5/includes/edit.css +
            200. + +
            201. + .ac_results
              + v5.5/includes/edit.css +
            202. + +
            203. + #qt_content_dfw
              + v5.5/includes/edit.css +
            204. + +
            205. + .post-type-attachment .screen-layout,.post-type-attachment .columns-prefs
              + v5.5/includes/edit.css +
            206. + +
            207. + .screen-layout,.columns-prefs
              + v5.5/includes/edit.css +
            208. + +
            209. + #content_wp_fullscreen
              + v5.5/includes/edit.css +
            210. + +
            211. + input[type="search"]::-webkit-search-decoration
              + v5.5/includes/forms.css +
            212. + +
            213. + .wp-core-ui select::-ms-expand
              + v5.5/includes/forms.css +
            214. + +
            215. + .wp-cancel-pw .dashicons-no
              + v5.5/includes/forms.css +
            216. + +
            217. + .pw-weak
              + v5.5/includes/forms.css +
            218. + +
            219. + .wp-pwd input::-ms-reveal
              + v5.5/includes/forms.css +
            220. + +
            221. + #pass1-text,.show-password #pass1
              + v5.5/includes/forms.css +
            222. + +
            223. + #pass1-text::-ms-clear
              + v5.5/includes/forms.css +
            224. + +
            225. + .request-filesystem-credentials-dialog
              + v5.5/includes/forms.css +
            226. + +
            227. + #request-filesystem-credentials-form .cancel-button
              + v5.5/includes/forms.css +
            228. + +
            229. + .wp-pwd .button .text
              + v5.5/includes/forms.css +
            230. + +
            231. + .button.hide-if-no-js,.hide-if-no-js
              + v5.5/includes/install.css +
            232. + +
            233. + .column-response .post-com-count-no-pending,.column-comments .post-com-count-no-pending
              + v5.5/includes/list-tables.css +
            234. + +
            235. + .fixed .column-comment .comment-author
              + v5.5/includes/list-tables.css +
            236. + +
            237. + .wp-list-table .toggle-row
              + v5.5/includes/list-tables.css +
            238. + +
            239. + .locked-indicator
              + v5.5/includes/list-tables.css +
            240. + +
            241. + .locked-info
              + v5.5/includes/list-tables.css +
            242. + +
            243. + tr.wp-locked .check-column label,tr.wp-locked .check-column input[type="checkbox"],tr.wp-locked .row-actions .inline,tr.wp-locked .row-actions .trash
              + v5.5/includes/list-tables.css +
            244. + +
            245. + .tablenav .no-pages,.tablenav .one-page .pagination-links
              + v5.5/includes/list-tables.css +
            246. + +
            247. + .plugin-card-update-failed .plugin-card-bottom
              + v5.5/includes/list-tables.css +
            248. + +
            249. + .tablenav br
              + v5.5/includes/list-tables.css +
            250. + +
            251. + .tablenav.top .actions,.tablenav .view-switch
              + v5.5/includes/list-tables.css +
            252. + +
            253. + .tablenav.top .displaying-num
              + v5.5/includes/list-tables.css +
            254. + +
            255. + .tablenav.top .tablenav-pages.one-page
              + v5.5/includes/list-tables.css +
            256. + +
            257. + .form-wrap>p
              + v5.5/includes/list-tables.css +
            258. + +
            259. + .wp-list-table th.column-primary~th,.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary~td:not(.check-column)
              + v5.5/includes/list-tables.css +
            260. + +
            261. + #comments-form .fixed .column-author,#commentsdiv .fixed .column-author
              + v5.5/includes/list-tables.css +
            262. + +
            263. + .fixed .column-author.hidden~.column-comment .comment-author
              + v5.5/includes/list-tables.css +
            264. + +
            265. + .column-response .post-com-count [aria-hidden="true"],.column-comments .post-com-count [aria-hidden="true"]
              + v5.5/includes/list-tables.css +
            266. + +
            267. + .comments-box .toggle-row,.wp-list-table.plugins .toggle-row
              + v5.5/includes/list-tables.css +
            268. + +
            269. + #wpbody-content .wp-list-table.plugins .desc.hidden
              + v5.5/includes/list-tables.css +
            270. + +
            271. + table.plugin-install th.column-name,table.plugin-install th.column-version,table.plugin-install th.column-rating,table.plugin-install th.column-description
              + v5.5/includes/list-tables.css +
            272. + +
            273. + .login .input::-ms-clear
              + v5.5/includes/login.css +
            274. + +
            275. + .no-js .hide-if-no-js
              + v5.5/includes/login.css +
            276. + +
            277. + input::-ms-reveal
              + v5.5/includes/login.css +
            278. + +
            279. + #wpbody-content #async-upload-wrap a
              + v5.5/includes/media.css +
            280. + +
            281. + .media-item .describe-toggle-off,.media-item.open .describe-toggle-on
              + v5.5/includes/media.css +
            282. + +
            283. + .media-item .startopen,.media-item .startclosed
              + v5.5/includes/media.css +
            284. + +
            285. + .js .html-uploader #plupload-upload-ui
              + v5.5/includes/media.css +
            286. + +
            287. + .drag-drop-inside p
              + v5.5/includes/media.css +
            288. + +
            289. + .media-frame.mode-grid .media-frame-title,.media-frame.mode-grid .media-frame-router,.media-frame.mode-grid .media-frame-menu
              + v5.5/includes/media.css +
            290. + +
            291. + .upload-php .mode-grid .hide-sidebar .media-sidebar
              + v5.5/includes/media.css +
            292. + +
            293. + .upload-php .mode-grid .media-sidebar .media-uploader-status.errors h2
              + v5.5/includes/media.css +
            294. + +
            295. + .imgedit-wait
              + v5.5/includes/media.css +
            296. + +
            297. + .no-js .wp_attachment_image .button
              + v5.5/includes/media.css +
            298. + +
            299. + .imgedit-help
              + v5.5/includes/media.css +
            300. + +
            301. + .has-no-menu-item .button-controls
              + v5.5/includes/nav-menus.css +
            302. + +
            303. + .metabox-holder-disabled .button-controls .select-all
              + v5.5/includes/nav-menus.css +
            304. + +
            305. + .hide-all
              + v5.5/includes/nav-menus.css +
            306. + +
            307. + .nav-menus-php .list-wrap
              + v5.5/includes/nav-menus.css +
            308. + +
            309. + .nav-menus-php .list li
              + v5.5/includes/nav-menus.css +
            310. + +
            311. + .no-js .menu-item-edit-active .item-edit
              + v5.5/includes/nav-menus.css +
            312. + +
            313. + .menu-item .menu-item-transport:empty
              + v5.5/includes/nav-menus.css +
            314. + +
            315. + .no-js.nav-menus-php .item-edit:before
              + v5.5/includes/nav-menus.css +
            316. + +
            317. + .menu-instructions-inactive
              + v5.5/includes/nav-menus.css +
            318. + +
            319. + .menu-item-settings .field-move .button-link
              + v5.5/includes/nav-menus.css +
            320. + +
            321. + .menu-item-edit-inactive .menu-item-settings
              + v5.5/includes/nav-menus.css +
            322. + +
            323. + .hidden-field
              + v5.5/includes/nav-menus.css +
            324. + +
            325. + .revisions .diff-error
              + v5.5/includes/revisions.css +
            326. + +
            327. + .comparing-two-revisions .revisions-previous,.comparing-two-revisions .revisions-next,.revisions-meta .diff-meta-to strong
              + v5.5/includes/revisions.css +
            328. + +
            329. + .diff-meta-from
              + v5.5/includes/revisions.css +
            330. + +
            331. + .revisions-tooltip
              + v5.5/includes/revisions.css +
            332. + +
            333. + .revisions.pinned .revisions-tooltip
              + v5.5/includes/revisions.css +
            334. + +
            335. + .revisions-tooltip
              + v5.5/includes/revisions.css +
            336. + +
            337. + .site-status-has-issues.hide
              + v5.5/includes/site-health.css +
            338. + +
            339. + .site-status-all-clear.hide
              + v5.5/includes/site-health.css +
            340. + +
            341. + .health-check-accordion-panel[hidden]
              + v5.5/includes/site-health.css +
            342. + +
            343. + body.js .theme-browser.search-loading
              + v5.5/includes/themes.css +
            344. + +
            345. + .theme-browser .theme .theme-author
              + v5.5/includes/themes.css +
            346. + +
            347. + .customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-header"],.customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-background"]
              + v5.5/includes/themes.css +
            348. + +
            349. + .theme-overlay .theme-actions .active-theme,.theme-overlay.active .theme-actions .inactive-theme
              + v5.5/includes/themes.css +
            350. + +
            351. + .single-theme .theme-overlay .theme-backdrop,.single-theme .theme-overlay .theme-header,.single-theme .theme
              + v5.5/includes/themes.css +
            352. + +
            353. + .theme-browser .theme.active .theme-name span
              + v5.5/includes/themes.css +
            354. + +
            355. + .theme:not(.active):hover .theme-actions,.theme:not(.active):focus .theme-actions,.theme:hover .more-details,.theme:focus .more-details
              + v5.5/includes/themes.css +
            356. + +
            357. + .single-theme .current-label
              + v5.5/includes/themes.css +
            358. + +
            359. + .upload-view-toggle .browse,.plugin-install-tab-upload .upload-view-toggle .upload
              + v5.5/includes/themes.css +
            360. + +
            361. + .upload-theme,.upload-plugin
              + v5.5/includes/themes.css +
            362. + +
            363. + p.no-themes,p.no-themes-local
              + v5.5/includes/themes.css +
            364. + +
            365. + .theme-install-php .add-new-theme
              + v5.5/includes/themes.css +
            366. + +
            367. + .wp-full-overlay.collapsed .collapse-sidebar-label
              + v5.5/includes/themes.css +
            368. + +
            369. + .wp-full-overlay-footer .devices
              + v5.5/includes/themes.css +
            370. + +
            371. + .collapsed .wp-full-overlay-footer .devices button:before
              + v5.5/includes/themes.css +
            372. + +
            373. + .no-customize-support .hide-if-no-customize,.customize-support .hide-if-customize,.no-customize-support.wp-core-ui .hide-if-no-customize,.no-customize-support .wp-core-ui .hide-if-no-customize,.customize-support.wp-core-ui .hide-if-customize,.customize-support .wp-core-ui .hide-if-customize
              + v5.5/includes/themes.css +
            374. + +
            375. + #customize-container
              + v5.5/includes/themes.css +
            376. + +
            377. + .theme-install-overlay
              + v5.5/includes/themes.css +
            378. + +
            379. + .install-theme-info
              + v5.5/includes/themes.css +
            380. + +
            381. + .widget.widget-dirty .widget-control-close-wrapper
              + v5.5/includes/widgets.css +
            382. + +
            383. + .wp-core-ui .media-widget-control.selected .placeholder,.wp-core-ui .media-widget-control.selected .not-selected,.wp-core-ui .media-widget-control .selected
              + v5.5/includes/widgets.css +
            384. + +
            385. + .media-frame.media-widget .image-details .embed-media-settings .setting.align,.media-frame.media-widget .attachment-display-settings .setting.align,.media-frame.media-widget .embed-media-settings .setting.align,.media-frame.media-widget .embed-media-settings .legend-inline,.media-frame.media-widget .embed-link-settings .setting.link-text,.media-frame.media-widget .replace-attachment,.media-frame.media-widget .checkbox-setting.autoplay
              + v5.5/includes/widgets.css +
            386. + +
            387. + #widgets-left .sidebar-name .toggle-indicator
              + v5.5/includes/widgets.css +
            388. + +
            389. + #available-widgets .widget-control-edit .edit,#available-widgets .widget-action .edit,#widgets-left .inactive-sidebar .widget-control-edit .add,#widgets-left .inactive-sidebar .widget-action .add,#widgets-right .widget-control-edit .add,#widgets-right .widget-action .add
              + v5.5/includes/widgets.css +
            390. + +
            391. + .js .widgets-holder-wrap.closed .widget,.js .widgets-holder-wrap.closed .sidebar-description,.js .widgets-holder-wrap.closed .remove-inactive-widgets,.js .widgets-holder-wrap.closed .description,.js .closed br.clear
              + v5.5/includes/widgets.css +
            392. + +
            393. + .widget-inside,.widget-description
              + v5.5/includes/widgets.css +
            394. + +
            395. + #removing-widget
              + v5.5/includes/widgets.css +
            396. + +
            397. + .widget-control-noform,#access-off,.widgets_access .widget-action,.widgets_access .handlediv,.widgets_access #access-on,.widgets_access .widget-holder .description,.no-js .widget-holder .description
              + v5.5/includes/widgets.css +
            398. + +
            399. + .widgets-chooser
              + v5.5/includes/widgets.css +
            400. + +
            401. + .text-widget-fields [hidden]
              + v5.5/includes/widgets.css +
            402. +
            +
            +
            +
            +

            + Selectors audit +

            + +
            +

            Total number of selectors: 12412

            +

            Number of selectors with IDs: 3726

            +

            Top 10 selectors with the highest specificity

            +
              + +
            1. + #side-sortables #postcustom #postcustomstuff #the-list textarea
              + v5.5/admin/edit.css +
            2. + +
            3. + #side-sortables #postcustom #postcustomstuff #the-list textarea
              + v5.5/includes/edit.css +
            4. + +
            5. + #dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish
              + v5.5/admin/dashboard.css +
            6. + +
            7. + #dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish
              + v5.5/includes/dashboard.css +
            8. + +
            9. + #wpbody #wpbody-content #dashboard-widgets.columns-1 .postbox-container
              + v5.5/admin/dashboard.css +
            10. + +
            11. + .post-type-attachment #wpbody-content #post-body.columns-2 #postbox-container-1
              + v5.5/admin/edit.css +
            12. + +
            13. + .post-type-attachment #poststuff #postbox-container-1 #side-sortables:empty
              + v5.5/admin/edit.css +
            14. + +
            15. + .post-type-attachment #poststuff #post-body.columns-2 #side-sortables
              + v5.5/admin/edit.css +
            16. + +
            17. + .is-dragging-metaboxes #poststuff #postbox-container-1 #side-sortables:empty
              + v5.5/admin/edit.css +
            18. + +
            19. + .is-dragging-metaboxes #poststuff #post-body.columns-2 #side-sortables
              + v5.5/admin/edit.css +
            20. +
            +

            Top 10 selectors by length

            +
              + +
            1. + .policy-text div>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)+*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              + v5.5/admin/edit.css +
            2. + +
            3. + .policy-text div>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)+*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              + v5.5/includes/edit.css +
            4. + +
            5. + .policy-text>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)+*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              + v5.5/admin/edit.css +
            6. + +
            7. + .policy-text>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)+*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              + v5.5/includes/edit.css +
            8. + +
            9. + #customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .customize-changeset-locked-message
              + v5.5/admin/customize-controls.css +
            10. + +
            11. + #customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .customize-changeset-locked-message
              + v5.5/includes/customize-controls.css +
            12. + +
            13. + .hide-privacy-policy-tutorial>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              + v5.5/admin/edit.css +
            14. + +
            15. + .hide-privacy-policy-tutorial>*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help)
              + v5.5/includes/edit.css +
            16. + +
            17. + #customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .currently-editing
              + v5.5/admin/customize-controls.css +
            18. + +
            19. + #customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .currently-editing
              + v5.5/includes/customize-controls.css +
            20. +
            +
            +
            +
            +

            + Media Queries audit +

            + +
            +

            Number of total media queries: 288

            +

            Number of seemingly-unique media queries: 72

            +

            Top 10 most-used media queries

            +
              +
            1. + 46 + screen and (max-width:782px) +
            2. + +
            3. + 16 + screen and (max-width:600px) +
            4. + +
            5. + 16 + print +
            6. + +
            7. + 16 + (-webkit-min-device-pixel-ratio:1.25) +
            8. + +
            9. + 16 + (min-resolution:120dpi) +
            10. + +
            11. + 10 + screen and (max-width:480px) +
            12. + +
            13. + 8 + only screen and (max-width:1120px) +
            14. + +
            15. + 6 + only screen and (max-width:480px) +
            16. + +
            17. + 6 + only screen and (max-width:782px) +
            18. + +
            19. + 6 + only screen and (max-width:799px) +
            20. + +
            +

            Number of unique breakpoint sizes: 57

            +

            Top 10 most-used breakpoint sizes

            +
              +
            1. + 54 + 782px +
            2. + +
            3. + 22 + 600px +
            4. + +
            5. + 18 + 480px +
            6. + +
            7. + 8 + 1120px +
            8. + +
            9. 8 + 320px +
            10. + +
            11. + 8 + 1200px +
            12. + +
            13. + 8 + 640px +
            14. + +
            15. + 6 + 799px +
            16. + +
            17. + 6 + 1600px +
            18. + +
            19. + 6 + 850px +
            20. + +
            +

            Top 10 least-used breakpoint sizes

            +
              +
            1. + 2 + 1250px +
            2. + +
            3. + 2 + 1024px +
            4. + +
            5. + 2 + 3333px +
            6. + +
            7. + 2 + 1667px +
            8. + +
            9. + 2 + 650px +
            10. + +
            11. + 2 + 780px +
            12. + +
            13. + 2 + 1640px +
            14. + +
            15. + 2 + 1680px +
            16. + +
            17. + 2 + 2000px +
            18. + +
            19. + 2 + 1004px +
            20. + +
            +

            Non-width related media queries

            +
              +
            1. + 16 (-webkit-min-device-pixel-ratio:1.25)
            2. - 8 - (min-resolution:120dpi) + 16 + (min-resolution:120dpi) +
            3. + +
            4. + 2 + (max-height:540px) +
            5. + +
            6. + 2 + (max-height:472px) +
            7. + +
            8. + 2 + (max-height:700px) +
            9. + +
            10. + 2 + (max-height:480px) +
            11. + +
            12. + 2 + (prefers-reduced-motion:reduce) +
            13. + +
            14. + 2 + (max-height:550px) +
            15. + +
            16. + 2 + (max-height:400px) +
            17. + +
            +
            +
            +
            +

            + Property Values: font-size, font-family, font-weight audit +

            + +
            +

            Number of values for font-size, font-family, font-weight: 996

            +

            Number of unique values for font-size, font-family, font-weight: 65

            +

            Top 10 most-used values for font-size, font-family, font-weight

            +
              +
            1. + 166 + 600 +
            2. + +
            3. + 138 + 14px +
            4. + +
            5. + 118 + 400 +
            6. + +
            7. + 98 + 13px +
            8. + +
            9. + 62 + 16px +
            10. + +
            11. + 56 + 12px +
            12. + +
            13. + 34 + 20px +
            14. + +
            15. + 30 + 11px +
            16. + +
            17. + 26 + 18px +
            18. + +
            19. + 24 + 1em +
            20. + +
            +

            Top 10 least-used values for font-size, font-family, font-weight

            +
              +
            1. + 2 + bold +
            2. + +
            3. + 2 + 100 +
            4. + +
            5. + 2 + 1.5rem +
            6. + +
            7. + 2 + 150px +
            8. + +
            9. + 2 + 0.4rem +
            10. + +
            11. + 2 + 0.7em +
            12. + +
            13. + 2 + normal +
            14. + +
            15. + 2 + 90% +
            16. + +
            17. + 2 + 60px +
            18. + +
            19. + 2 + 9px +
            20. + +
            +
            +
            +
            +

            + Property Values: padding-top, padding-bottom, padding-left, padding-right audit +

            + +
            +

            Number of values for padding-top, padding-bottom, padding-left, padding-right: 442

            +

            Number of unique values for padding-top, padding-bottom, padding-left, padding-right: 51

            +

            Top 10 most-used values for padding-top, padding-bottom, padding-left, padding-right

            +
              +
            1. + 80 + 0 +
            2. + +
            3. + 36 + 10px +
            4. + +
            5. + 28 + 6px +
            6. + +
            7. + 24 + 16px +
            8. + +
            9. + 24 + 12px +
            10. + +
            11. + 22 + 15px +
            12. + +
            13. + 18 + 20px +
            14. + +
            15. + 16 + 7px +
            16. + +
            17. + 14 + 8px +
            18. + +
            19. + 12 + 4px +
            20. + +
            +

            Top 10 least-used values for padding-top, padding-bottom, padding-left, padding-right

            +
              +
            1. + 2 + 48px +
            2. + +
            3. + 2 + 110px +
            4. + +
            5. + 2 + 66.66666% +
            6. + +
            7. + 2 + 20% +
            8. + +
            9. + 2 + 94px +
            10. + +
            11. + 2 + 2.5rem +
            12. + +
            13. + 2 + 13px +
            14. + +
            15. + 2 + 5rem +
            16. + +
            17. + 2 + 90px +
            18. + +
            19. + 2 + 125px +
            20. + +
            +
            +
            +
            +

            + Property Values: margin, margin-top, margin-bottom, margin-left, margin-right audit +

            + +
            +

            Number of values for margin, margin-top, margin-bottom, margin-left, margin-right: 2980

            +

            Number of unique values for margin, margin-top, margin-bottom, margin-left, margin-right: 429

            +

            Top 10 most-used values for margin, margin-top, margin-bottom, margin-left, margin-right

            +
              +
            1. + 868 + 0 +
            2. + +
            3. + 102 + 10px +
            4. + +
            5. + 88 + 5px +
            6. + +
            7. + 68 + 20px +
            8. + +
            9. + 60 + 1em +
            10. + +
            11. + 56 + 15px +
            12. + +
            13. + 54 + 8px +
            14. + +
            15. + 50 + 12px +
            16. + +
            17. + 44 + 4px +
            18. + +
            19. + 42 + 6px +
            20. + +
            +

            Top 10 least-used values for margin, margin-top, margin-bottom, margin-left, margin-right

            +
              +
            1. + 2 + 2% +
            2. + +
            3. + 2 + 0.25rem 0.25rem 0.25rem 0 +
            4. + +
            5. + 2 + -5px 0 10px 10px +
            6. + +
            7. + 2 + -5px 5px +
            8. + +
            9. + 2 + 10px 0 0 0 +
            10. + +
            11. + 2 + 5px 3px 0 0 +
            12. + +
            13. + 2 + 4.5% +
            14. + +
            15. + 2 + -1.79104477% +
            16. + +
            17. + 2 + 8px 10px 0 0 +
            18. + +
            19. + 2 + auto 0 auto -360px +
            20. + +
            +
            +
            +
            +

            + Property Values: width, min-width, max-width audit +

            + +
            +

            Number of values for width, min-width, max-width: 1572

            +

            Number of unique values for width, min-width, max-width: 236

            +

            Top 10 most-used values for width, min-width, max-width

            +
              +
            1. + 420 + 100% +
            2. + +
            3. + 114 + auto +
            4. + +
            5. + 48 + 20px +
            6. + +
            7. + 38 + 0 +
            8. + +
            9. + 30 + 30px +
            10. + +
            11. + 20 + 280px +
            12. + +
            13. + 16 + 80px +
            14. + +
            15. + 16 + 25%
            16. - 6 - screen and (max-width:480px) + 16 + none
            17. - 4 - only screen and (max-width:1120px) + 14 + 180px +
            18. + +
            +

            Top 10 least-used values for width, min-width, max-width

            +
              +
            1. + 2 + 480px
            2. - 3 - only screen and (max-width:480px) + 2 + 58%
            3. - 3 - only screen and (max-width:782px) + 2 + 38px
            4. - 3 - only screen and (max-width:799px) + 2 + 33.33% +
            5. + +
            6. + 2 + 258px +
            7. + +
            8. + 2 + 720px +
            9. + +
            10. + 2 + calc(18% - 1px) +
            11. + +
            12. + 2 + 599px +
            13. + +
            14. + 2 + 3px +
            15. + +
            16. + 2 + 40rem
            -

            Number of unique breakpoint sizes: 57

            -

            Top 10 most-used breakpoint sizes

            +
            +
            +
            +

            + Property Values: height, max-height, min-height audit +

            + +
            +

            Number of values for height, max-height, min-height: 810

            +

            Number of unique values for height, max-height, min-height: 114

            +

            Top 10 most-used values for height, max-height, min-height

            1. - 27 - 782px + 100 + auto
            2. - 11 - 600px + 64 + 100%
            3. - 10 + 58 + 0 +
            4. + +
            5. + 48 + 20px +
            6. + +
            7. + 36 + 30px +
            8. + +
            9. + 32 + 40px +
            10. + +
            11. + 22 + 32px +
            12. + +
            13. + 18 + 18px +
            14. + +
            15. + 18 + 28px +
            16. + +
            17. + 16 + 34px +
            18. + +
            +

            Top 10 least-used values for height, max-height, min-height

            +
              +
            1. + 2 + 123px +
            2. + +
            3. + 2 + 132px +
            4. + +
            5. + 2 + 1080px +
            6. + +
            7. + 2 480px
            8. - 4 - 1120px + 2 + 12px
            9. - 4 - 320px + 2 + 330px
            10. - 4 - 1200px + 2 + 170px
            11. - 4 - 640px + 2 + 124px
            12. - 3 - 799px + 2 + 140px
            13. - 3 - 1600px + 2 + 82px +
            14. + +
            +
            +
            +
            +

            + Property Values: font-size, font, line-height, font-family, letter-spacing audit +

            + +
            +

            Number of values for font-size, font, line-height, font-family, letter-spacing: 1342

            +

            Number of unique values for font-size, font, line-height, font-family, letter-spacing: 156

            +

            Top 10 most-used values for font-size, font, line-height, font-family, letter-spacing

            +
              +
            1. + 138 + 14px
            2. - 3 - 850px + 98 + 13px +
            3. + +
            4. + 70 + 16px +
            5. + +
            6. + 62 + 1.5 +
            7. + +
            8. + 58 + normal 20px/1 dashicons +
            9. + +
            10. + 56 + 12px +
            11. + +
            12. + 44 + 1.4 +
            13. + +
            14. + 44 + inherit +
            15. + +
            16. + 40 + 2 +
            17. + +
            18. + 40 + 20px
            -

            Top 10 least-used breakpoint sizes

            +

            Top 10 least-used values for font-size, font, line-height, font-family, letter-spacing

            1. - 1 - 1250px + 2 + normal 26px/1 dashicons
            2. - 1 - 1024px + 2 + 3.30769230
            3. - 1 - 3333px + 2 + normal 60px/1 'dashicons'
            4. - 1 - 1667px + 2 + normal 20px/30px "dashicons"
            5. - 1 - 650px + 2 + normal 22px/1 dashicons
            6. - 1 - 780px + 2 + 2.9
            7. - 1 - 1640px + 2 + normal 60px/90px dashicons
            8. - 1 - 1680px + 2 + normal 22px/50px dashicons
            9. - 1 - 2000px + 2 + normal 74px/115px dashicons
            10. - 1 - 1004px + 2 + 1.5rem
            -

            Non-width related media queries

            +
            +
            +
            +

            + Property Values: background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width audit +

            + +
            +

            Number of values for background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width: 8696

            +

            Number of unique values for background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width: 1118

            +

            Top 10 most-used values for background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width

            1. - 8 - (-webkit-min-device-pixel-ratio:1.25) + 1400 + 0
            2. - 8 - (min-resolution:120dpi) + 508 + 100%
            3. - 1 - (max-height:540px) + 400 + none
            4. - 1 - (max-height:472px) + 270 + auto
            5. - 1 - (max-height:700px) + 170 + 20px
            6. - 1 - (max-height:480px) + 142 + 14px
            7. - 1 - (prefers-reduced-motion:reduce) + 108 + 13px
            8. - 1 - (max-height:550px) + 106 + 16px
            9. - 1 - (max-height:400px) + 98 + 12px +
            10. + +
            11. + 86 + 30px +
            12. + +
            +

            Top 10 least-used values for background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width

            +
              +
            1. + 2 + 0.25rem 0.25rem 0.25rem 0 +
            2. + +
            3. + 2 + 10px 0 12px 0 +
            4. + +
            5. + 2 + normal 26px/1 dashicons +
            6. + +
            7. + 2 + 10px 15px 10px 35px +
            8. + +
            9. + 2 + 1px solid #444 +
            10. + +
            11. + 2 + 3.30769230 +
            12. + +
            13. + 2 + -5px 0 10px 10px +
            14. + +
            15. + 2 + -5px 5px +
            16. + +
            17. + 2 + 123px +
            18. + +
            19. + 2 + 15px 7px
            diff --git a/src/utils/cli.js b/src/utils/cli.js index bd5b59d..feb65fd 100644 --- a/src/utils/cli.js +++ b/src/utils/cli.js @@ -46,10 +46,10 @@ const getConfig = ( env ) => { * config if its not present. * * @param {string} arg - * @param {boolean} cliOnly + * @param {boolean} cliArgOnly */ -const getArg = ( arg, cliOnly = false ) => { +const getArg = ( arg, cliArgOnly = false ) => { for ( const cliArg of getArgsFromCLI() ) { const [ name, value ] = cliArg.split( '=' ); @@ -58,7 +58,7 @@ const getArg = ( arg, cliOnly = false ) => { } } - if ( true === cliOnly ) { + if ( true === cliArgOnly ) { return false; } From 7f97c69506b47e78f7dc91e357366d4215c4383e Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 13 Jan 2021 16:08:36 -0500 Subject: [PATCH 46/47] fix: PR feedback --- README.md | 2 +- css-audit.config.js | 27 +- index.js | 2 +- package.json | 2 +- public/wp-admin.html | 758 +----------------- src/formats/html.js | 4 +- .../templates/audits/property-values.twig | 23 - src/run.js | 16 +- 8 files changed, 34 insertions(+), 800 deletions(-) delete mode 100644 src/formats/templates/audits/property-values.twig diff --git a/README.md b/README.md index b9efd4c..0540f4d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ $ git clone git@github.com:ryelle/css-audit.git $ cd css-audit $ npm install $ npm run css-audit -- -`` +``` If you want to work on the audits yourself, [fork this repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) to your account first. You can submit issues or PRs. diff --git a/css-audit.config.js b/css-audit.config.js index 401477e..41bafc0 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -1,29 +1,8 @@ module.exports = { format: 'html', - filename: 'wp-admin', all: true, + filename: 'wp-admin', audits: [ - [ 'property-values', 'font-size,font-family,font-weight' ], - [ - 'property-values', - 'padding-top,padding-bottom,padding-left,padding-right', - ], - [ - 'property-values', - 'margin,margin-top,margin-bottom,margin-left,margin-right', - ], - [ 'property-values', 'width,min-width,max-width' ], - [ 'property-values', 'height,max-height,min-height' ], - [ 'property-values', 'top', 'bottom', 'right', 'left' ][ - ( 'property-values', 'z-index' ) - ], - [ - 'property-values', - 'font-size,font,line-height,font-family,letter-spacing', - ], - [ - 'property-values', - 'background-position,background-size,border,border-radius,bottom,box-shadow,clip,font,font-size,height,left,line-height,letter-spacing,margin,max-height,max-width,min-height,min-width,outline,outline-offset,padding,right,text-indent,text-shadow,top,transform,width', - ], + ['property-values', 'font-size'] ], -}; +}; \ No newline at end of file diff --git a/index.js b/index.js index 040dda8..8e9599f 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ const { getArg, getFileArgsFromCLI, getHelp } = require( './src/utils/cli' ); const input = getFileArgsFromCLI(); if ( getArg( '--help', true ) || ! input.length ) { - console.log( getHelp() ); // eslint-disable-line no-console + console.log( getHelp() ); process.exit( 0 ); } diff --git a/package.json b/package.json index 5a466f4..c62be3b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "css-audit": "node ./index.js", "lint:js": "eslint src", - "format:js": "prettier *.js {src,.}/**/*.js src/**/**/*.js --write", + "format:js": "prettier src *.js --write", "test": "jest" }, "author": "Kelly Dwan", diff --git a/public/wp-admin.html b/public/wp-admin.html index 01f9de0..8ff9ce6 100644 --- a/public/wp-admin.html +++ b/public/wp-admin.html @@ -38,37 +38,7 @@

            CSS Audit for wp-admin

          12. - Property Values: font-size, font-family, font-weight audit - -
          13. -
          14. - - Property Values: padding-top, padding-bottom, padding-left, padding-right audit - -
          15. -
          16. - - Property Values: margin, margin-top, margin-bottom, margin-left, margin-right audit - -
          17. -
          18. - - Property Values: width, min-width, max-width audit - -
          19. -
          20. - - Property Values: height, max-height, min-height audit - -
          21. -
          22. - - Property Values: font-size, font, line-height, font-family, letter-spacing audit - -
          23. -
          24. - - Property Values: background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width audit + Property Values: font-size audit
          25. @@ -3891,29 +3861,19 @@

            Non-width related media queries

            - Property Values: font-size, font-family, font-weight audit + Property Values: font-size audit

            -

            Number of values for font-size, font-family, font-weight: 996

            -

            Number of unique values for font-size, font-family, font-weight: 65

            -

            Top 10 most-used values for font-size, font-family, font-weight

            +

            Number of values for font-size: 628

            +

            Number of unique values for font-size: 47

            +

            Top 10 most-used values for font-size

            1. - 166 - 600 -
            2. - -
            3. 138 14px
            4. -
            5. - 118 - 400 -
            6. -
            7. 98 13px @@ -3949,20 +3909,20 @@

              Top 10 most-used values for font-size, font-family, font-weight

              1em
            8. -
            -

            Top 10 least-used values for font-size, font-family, font-weight

            -
              -
            1. - 2 - bold +
            2. + 16 + 1.4em
            3. - 2 - 100 + 14 + inherit
            4. -
            5. +
            +

            Top 10 least-used values for font-size

            +
              +
            1. 2 1.5rem
            2. @@ -3984,11 +3944,6 @@

              Top 10 least-used values for font-size, font-family, font-weight

            3. 2 - normal -
            4. - -
            5. - 2 90%
            6. @@ -4002,700 +3957,19 @@

              Top 10 least-used values for font-size, font-family, font-weight

              9px -
            -
            -
            -
            -

            - Property Values: padding-top, padding-bottom, padding-left, padding-right audit -

            - -
            -

            Number of values for padding-top, padding-bottom, padding-left, padding-right: 442

            -

            Number of unique values for padding-top, padding-bottom, padding-left, padding-right: 51

            -

            Top 10 most-used values for padding-top, padding-bottom, padding-left, padding-right

            -
              -
            1. - 80 - 0 -
            2. - -
            3. - 36 - 10px -
            4. - -
            5. - 28 - 6px -
            6. - -
            7. - 24 - 16px -
            8. - -
            9. - 24 - 12px -
            10. - -
            11. - 22 - 15px -
            12. - -
            13. - 18 - 20px -
            14. - -
            15. - 16 - 7px -
            16. - -
            17. - 14 - 8px -
            18. - -
            19. - 12 - 4px -
            20. - -
            -

            Top 10 least-used values for padding-top, padding-bottom, padding-left, padding-right

            -
              -
            1. - 2 - 48px -
            2. - -
            3. - 2 - 110px -
            4. - -
            5. - 2 - 66.66666% -
            6. - -
            7. - 2 - 20% -
            8. - -
            9. - 2 - 94px -
            10. - -
            11. - 2 - 2.5rem -
            12. - -
            13. - 2 - 13px -
            14. -
            15. 2 - 5rem -
            16. - -
            17. - 2 - 90px -
            18. - -
            19. - 2 - 125px -
            20. - -
            -
            -
            -
            -

            - Property Values: margin, margin-top, margin-bottom, margin-left, margin-right audit -

            - -
            -

            Number of values for margin, margin-top, margin-bottom, margin-left, margin-right: 2980

            -

            Number of unique values for margin, margin-top, margin-bottom, margin-left, margin-right: 429

            -

            Top 10 most-used values for margin, margin-top, margin-bottom, margin-left, margin-right

            -
              -
            1. - 868 - 0 -
            2. - -
            3. - 102 - 10px -
            4. - -
            5. - 88 - 5px -
            6. - -
            7. - 68 - 20px -
            8. - -
            9. - 60 - 1em -
            10. - -
            11. - 56 - 15px -
            12. - -
            13. - 54 - 8px -
            14. - -
            15. - 50 - 12px -
            16. - -
            17. - 44 - 4px -
            18. - -
            19. - 42 - 6px -
            20. - -
            -

            Top 10 least-used values for margin, margin-top, margin-bottom, margin-left, margin-right

            -
              -
            1. - 2 - 2% -
            2. - -
            3. - 2 - 0.25rem 0.25rem 0.25rem 0 -
            4. - -
            5. - 2 - -5px 0 10px 10px -
            6. - -
            7. - 2 - -5px 5px -
            8. - -
            9. - 2 - 10px 0 0 0 -
            10. - -
            11. - 2 - 5px 3px 0 0 -
            12. - -
            13. - 2 - 4.5% -
            14. - -
            15. - 2 - -1.79104477% -
            16. - -
            17. - 2 - 8px 10px 0 0 -
            18. - -
            19. - 2 - auto 0 auto -360px -
            20. - -
            -
            -
            -
            -

            - Property Values: width, min-width, max-width audit -

            - -
            -

            Number of values for width, min-width, max-width: 1572

            -

            Number of unique values for width, min-width, max-width: 236

            -

            Top 10 most-used values for width, min-width, max-width

            -
              -
            1. - 420 100%
            2. -
            3. - 114 - auto -
            4. - -
            5. - 48 - 20px -
            6. - -
            7. - 38 - 0 -
            8. - -
            9. - 30 - 30px -
            10. - -
            11. - 20 - 280px -
            12. - -
            13. - 16 - 80px -
            14. - -
            15. - 16 - 25% -
            16. - -
            17. - 16 - none -
            18. - -
            19. - 14 - 180px -
            20. - -
            -

            Top 10 least-used values for width, min-width, max-width

            -
              -
            1. - 2 - 480px -
            2. - -
            3. - 2 - 58% -
            4. - -
            5. - 2 - 38px -
            6. - -
            7. - 2 - 33.33% -
            8. - -
            9. - 2 - 258px -
            10. - -
            11. - 2 - 720px -
            12. - -
            13. - 2 - calc(18% - 1px) -
            14. - -
            15. - 2 - 599px -
            16. - -
            17. - 2 - 3px -
            18. - -
            19. - 2 - 40rem -
            20. - -
            -
            -
            -
            -

            - Property Values: height, max-height, min-height audit -

            - -
            -

            Number of values for height, max-height, min-height: 810

            -

            Number of unique values for height, max-height, min-height: 114

            -

            Top 10 most-used values for height, max-height, min-height

            -
              -
            1. - 100 - auto -
            2. - -
            3. - 64 - 100% -
            4. - -
            5. - 58 - 0 -
            6. - -
            7. - 48 - 20px -
            8. - -
            9. - 36 - 30px -
            10. - -
            11. - 32 - 40px -
            12. - -
            13. - 22 - 32px -
            14. - -
            15. - 18 - 18px -
            16. - -
            17. - 18 - 28px -
            18. - -
            19. - 16 - 34px -
            20. - -
            -

            Top 10 least-used values for height, max-height, min-height

            -
              -
            1. - 2 - 123px -
            2. - -
            3. - 2 - 132px -
            4. - -
            5. - 2 - 1080px -
            6. - -
            7. - 2 - 480px -
            8. - -
            9. - 2 - 12px -
            10. - -
            11. - 2 - 330px -
            12. - -
            13. - 2 - 170px -
            14. - -
            15. - 2 - 124px -
            16. - -
            17. - 2 - 140px -
            18. - -
            19. - 2 - 82px -
            20. - -
            -
            -
            -
            -

            - Property Values: font-size, font, line-height, font-family, letter-spacing audit -

            - -
            -

            Number of values for font-size, font, line-height, font-family, letter-spacing: 1342

            -

            Number of unique values for font-size, font, line-height, font-family, letter-spacing: 156

            -

            Top 10 most-used values for font-size, font, line-height, font-family, letter-spacing

            -
              -
            1. - 138 - 14px -
            2. - -
            3. - 98 - 13px -
            4. - -
            5. - 70 - 16px -
            6. - -
            7. - 62 - 1.5 -
            8. - -
            9. - 58 - normal 20px/1 dashicons -
            10. - -
            11. - 56 - 12px -
            12. - -
            13. - 44 - 1.4 -
            14. - -
            15. - 44 - inherit -
            16. - -
            17. - 40 - 2 -
            18. - -
            19. - 40 - 20px -
            20. - -
            -

            Top 10 least-used values for font-size, font, line-height, font-family, letter-spacing

            -
              -
            1. - 2 - normal 26px/1 dashicons -
            2. - -
            3. - 2 - 3.30769230 -
            4. - -
            5. - 2 - normal 60px/1 'dashicons' -
            6. - -
            7. - 2 - normal 20px/30px "dashicons" -
            8. - -
            9. - 2 - normal 22px/1 dashicons -
            10. - -
            11. - 2 - 2.9 -
            12. - -
            13. - 2 - normal 60px/90px dashicons -
            14. - -
            15. - 2 - normal 22px/50px dashicons -
            16. - -
            17. - 2 - normal 74px/115px dashicons -
            18. - -
            19. - 2 - 1.5rem -
            20. - -
            -
            -
            -
            -

            - Property Values: background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width audit -

            - -
            -

            Number of values for background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width: 8696

            -

            Number of unique values for background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width: 1118

            -

            Top 10 most-used values for background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width

            -
              -
            1. - 1400 - 0 -
            2. - -
            3. - 508 - 100% -
            4. - -
            5. - 400 - none -
            6. - -
            7. - 270 - auto -
            8. - -
            9. - 170 - 20px -
            10. - -
            11. - 142 - 14px -
            12. - -
            13. - 108 - 13px -
            14. - -
            15. - 106 - 16px -
            16. - -
            17. - 98 - 12px -
            18. - -
            19. - 86 - 30px -
            20. - -
            -

            Top 10 least-used values for background-position, background-size, border, border-radius, bottom, box-shadow, clip, font, font-size, height, left, line-height, letter-spacing, margin, max-height, max-width, min-height, min-width, outline, outline-offset, padding, right, text-indent, text-shadow, top, transform, width

            -
              -
            1. - 2 - 0.25rem 0.25rem 0.25rem 0 -
            2. - -
            3. - 2 - 10px 0 12px 0 -
            4. - -
            5. - 2 - normal 26px/1 dashicons -
            6. - -
            7. - 2 - 10px 15px 10px 35px -
            8. - -
            9. - 2 - 1px solid #444 -
            10. - -
            11. - 2 - 3.30769230 -
            12. - -
            13. - 2 - -5px 0 10px 10px -
            14. - -
            15. - 2 - -5px 5px -
            16. -
            17. 2 - 123px + 26px
            18. 2 - 15px 7px + 1.1em
            diff --git a/src/formats/html.js b/src/formats/html.js index 38bc64f..7654c11 100644 --- a/src/formats/html.js +++ b/src/formats/html.js @@ -41,10 +41,10 @@ module.exports = function ( reports ) { twing .render( reportTemplate, context ) .then( ( output ) => { - console.log( `Generated template for ${ reportName }.` ); // eslint-disable-line no-console + console.log( `Generated template for ${ reportName }.` ); fs.writeFileSync( reportDest, output ); } ) .catch( ( e ) => { - console.error( e ); // eslint-disable-line no-console + console.error( e ); } ); }; diff --git a/src/formats/templates/audits/property-values.twig b/src/formats/templates/audits/property-values.twig deleted file mode 100644 index 9ab47e8..0000000 --- a/src/formats/templates/audits/property-values.twig +++ /dev/null @@ -1,23 +0,0 @@ -{% if data is iterable %} -
            -

            {{data[0].audit|capitalize}}

            - {% for item in data %} - {% if item.value is iterable %} -

            {{item.label}}

            -
              - {% for value in item.value %} - {% if value.name %} -
            • {{value.name}} - {{value.count}}
            • - {% endif %} - - {% if value.file %} -
            • {{value.file}} - {{value.selector}}
            • - {% endif %} - {% endfor %} -
            - {% else %} -

            {{item.label}}: {{item.value}}

            - {% endif %} - {% endfor %} -
            -{% endif %} \ No newline at end of file diff --git a/src/run.js b/src/run.js index 9769a3a..2d9dfc9 100644 --- a/src/run.js +++ b/src/run.js @@ -38,12 +38,16 @@ const runAudits = ( cssFiles ) => { ); } ); } else { - audits.push( - require( './audits/property-values' )( - cssFiles, - propertyValues.split( ',' ) - ) - ); + + // Single property-value audit handling for CLI + if ( !! propertyValues ) { + audits.push( + require( './audits/property-values' )( + cssFiles, + propertyValues.split( ',' ) + ) + ); + } } const reports = audits.flat().filter( Boolean ); From 3940bca2b581284a7925d94e8f5c46f92829bdb3 Mon Sep 17 00:00:00 2001 From: laras126 Date: Wed, 13 Jan 2021 16:10:37 -0500 Subject: [PATCH 47/47] fix: format --- css-audit.config.js | 6 ++---- src/run.js | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/css-audit.config.js b/css-audit.config.js index 41bafc0..bbd7fd7 100644 --- a/css-audit.config.js +++ b/css-audit.config.js @@ -2,7 +2,5 @@ module.exports = { format: 'html', all: true, filename: 'wp-admin', - audits: [ - ['property-values', 'font-size'] - ], -}; \ No newline at end of file + audits: [ [ 'property-values', 'font-size' ] ], +}; diff --git a/src/run.js b/src/run.js index 2d9dfc9..a6afd38 100644 --- a/src/run.js +++ b/src/run.js @@ -38,7 +38,6 @@ const runAudits = ( cssFiles ) => { ); } ); } else { - // Single property-value audit handling for CLI if ( !! propertyValues ) { audits.push(