Skip to content

Commit

Permalink
Update linting to use repo-tools configs (#2398)
Browse files Browse the repository at this point in the history
* Lint using repo-tools configs

* Git ignore all repo-tools configs and extend phpcs config

* Add setup step to lint workflow

* Restore phpcs config

* Remove locale-switcher package lock

It should use the yarn.lock

* Stop tracking locale-switcher as it lives in SVN

* Update lint workflow

* Revert removing locale-switcher from source

Reset changes from composer install in lint workflow instead
  • Loading branch information
adamwoodnz authored Apr 30, 2024
1 parent 41aeaa6 commit 03a10e0
Show file tree
Hide file tree
Showing 27 changed files with 91 additions and 15,537 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ jobs:
mkdir wp-content/themes/pub/wporg
svn export https://meta.svn.wordpress.org/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/css wp-content/themes/pub/wporg/css
- name: composer install
run: |
composer install
- name: Git reset and clean
run: |
git reset --hard
git clean -f -d
- name: Setup tools
run: |
yarn setup:tools
- name: Install NodeJS
uses: actions/setup-node@v4
with:
Expand All @@ -29,18 +42,13 @@ jobs:
- name: yarn install and build
run: |
yarn
yarn workspaces run build
yarn build
- name: Lint JavaScript and Styles
run: |
yarn workspaces run lint:js
yarn workspaces run lint:css
- name: composer install
run: |
composer install
yarn lint:js
yarn lint:css
- name: Lint PHP
run: |
composer run lint
yarn lint:php
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

.wp-env.override.json

# Configs from wporg-repo-tools.
.eslintrc.js
.prettierrc.js
.stylelintrc

# Ignore 3rd-party code.
/wp-content/*
/wp-content/mu-plugins/*
Expand All @@ -22,6 +27,7 @@
!/wp-content/mu-plugins/pub/locales.php
!/wp-content/mu-plugins/pub/class-validator.php
!/wp-content/mu-plugins/pub/locale-switcher
!/wp-content/mu-plugins/pub/locale-switcher/.eslintrc.js
!/wp-content/plugins
!/wp-content/plugins/wporg-learn
!/wp-content/plugins/sensei-pro
Expand Down
12 changes: 0 additions & 12 deletions .stylelintrc

This file was deleted.

12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"@wordpress/scripts": "27.2.0",
"@wordpress/stylelint-config": "21.34.0"
},
"resolutions": {
"eslint-plugin-jsdoc": "^46.4.6"
},
"workspaces": {
"packages": [
"wp-content/mu-plugins/pub/locale-switcher",
Expand All @@ -26,15 +23,16 @@
"scripts": {
"install:env": "./bin/index.sh",
"install:githooks": "mv .git/hooks .git/hooks_orig && ln -s ../.githooks .git/hooks",
"create": "composer install && yarn workspaces run build && yarn run install:env",
"build": "yarn workspaces run build",
"create": "composer install && yarn setup:tools && yarn workspaces run build && yarn run install:env",
"wp-env": "wp-env",
"lint:php": "composer run lint",
"format:php": "composer run format",
"lint:css": "yarn workspace wporg-learn-plugin lint:css && yarn workspace wporg-learn-theme lint:css",
"lint:js": "yarn workspace wporg-learn-plugin lint:js",
"lint:css": "yarn workspaces run lint:css",
"lint:js": "yarn workspaces run lint:js",
"watch:theme": "yarn workspace wporg-learn-theme start",
"watch:plugin": "yarn workspace wporg-learn-plugin start",
"setup:tools": "exit 0"
"setup:tools": "TEXTDOMAIN=wporg-learn composer exec update-configs"
},
"main": "index.js"
}
9 changes: 9 additions & 0 deletions wp-content/mu-plugins/pub/locale-switcher/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
extends: '../../../../.eslintrc.js',
rules: {
/*
* Set up our text domain.
*/
'@wordpress/i18n-text-domain': [ 'error', { allowedTextDomain: [ 'wporg' ] } ],
},
};
Loading

0 comments on commit 03a10e0

Please sign in to comment.