Skip to content

Commit

Permalink
Update the npm scripts to use wp-scripts for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nani-samireddy committed Feb 10, 2025
1 parent d451ca5 commit f0081e3
Show file tree
Hide file tree
Showing 11 changed files with 13,360 additions and 3,597 deletions.
28 changes: 27 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
{
"extends": [ "plugin:@wordpress/eslint-plugin/recommended" ]
"root": true,
"extends": [
"plugin:@wordpress/eslint-plugin/recommended-with-formatting",
"plugin:import/recommended",
"plugin:eslint-comments/recommended"
],
"env": {
"browser": true
},
"rules": {
"jsdoc/check-indentation": "error",
"@wordpress/dependency-group": "error"
},
"overrides": [{
"files": [
"**/__tests__/**/*.js",
"**/test/*.js",
"**/?(*.)test.js",
"tests/js/**/*.js"
],
"extends": [
"plugin:jest/all"
],
"rules": {
// Add Rules for Jest here
}
}]
}
3 changes: 3 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ module.exports = {
"**/*.{css,scss}": [
"npm run lint:css"
],
"package.json": [
"npm run lint:package-json"
],
};
7 changes: 5 additions & 2 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"extends": "@wordpress/stylelint-config/scss",
"ignoreFiles": ["**/build/**"]
"extends": "@wordpress/stylelint-config/scss",
"ignoreFiles": [
"**/*.js"
],
"rules": {}
}
47 changes: 24 additions & 23 deletions assets/src/js/admin/customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,40 @@
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
* @param {Object} $ jQuery object.
*/

(($) => {
( ( $ ) => {
// Site title and description.
wp.customize('blogname', (value) => {
value.bind(function (to) {
$('.site-title a').text(to);
});
});
wp.customize( 'blogname', ( value ) => {
value.bind( function( to ) {
$( '.site-title a' ).text( to );
} );
} );

wp.customize('blogdescription', (value) => {
value.bind(function (to) {
$('.site-description').text(to);
});
});
wp.customize( 'blogdescription', ( value ) => {
value.bind( function( to ) {
$( '.site-description' ).text( to );
} );
} );

// Header text color.
wp.customize('header_textcolor', (value) => {
value.bind(function (to) {
if ('blank' === to) {
$('.site-title, .site-description').css({
wp.customize( 'header_textcolor', ( value ) => {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '.site-title, .site-description' ).css( {
clip: 'rect(1px, 1px, 1px, 1px)',
position: 'absolute',
});
} );
} else {
$('.site-title, .site-description').css({
$( '.site-title, .site-description' ).css( {
clip: 'auto',
position: 'relative',
});
$('.site-title a, .site-description').css({
} );
$( '.site-title a, .site-description' ).css( {
color: to,
});
} );
}
});
});
} )( jQuery ); // eslint-disable-line -- no-undef
} );
} );
} )( jQuery ); // eslint-disable-line no-undef
4 changes: 2 additions & 2 deletions assets/src/js/components/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ const WebFont = {
loadWebFonts() {
const WebFontConfig = {
google: {
families: ['Open Sans:300,400,700', 'Roboto:500'],
families: [ 'Open Sans:300,400,700', 'Roboto:500' ],
},
};

WebFontLoader.load(WebFontConfig);
WebFontLoader.load( WebFontConfig );
},
};

Expand Down
3 changes: 3 additions & 0 deletions assets/src/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
* Home scripts.
*/

/**
* Internal dependencies
*/
import '../sass/home.scss';
3 changes: 3 additions & 0 deletions assets/src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* Main scripts, loaded on all pages.
*/

/**
* Internal dependencies
*/
import '../sass/main.scss';
import { common as BlankThemeCommons } from './components';

Expand Down
3 changes: 3 additions & 0 deletions assets/src/js/single.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
* Single page scripts.
*/

/**
* Internal dependencies
*/
import '../sass/single.scss';
Loading

0 comments on commit f0081e3

Please sign in to comment.