Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into 4475-fix-related-key…
Browse files Browse the repository at this point in the history
…phrase-status
  • Loading branch information
mykola committed Jan 9, 2025
2 parents 1aed651 + abf031a commit 1241e1e
Show file tree
Hide file tree
Showing 294 changed files with 2,855 additions and 2,397 deletions.
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

55 changes: 0 additions & 55 deletions .eslintrc

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
18 changes: 11 additions & 7 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ on:
- 'composer.lock'
- '.phpcs.xml.dist'
- 'phpcs.xml.dist'
- '.github/workflows/cs.yml'
- '.github/workflows/**'
pull_request:
paths:
- '**.php' # Includes config/*.php files.
- 'composer.json'
- 'composer.lock'
- '.phpcs.xml.dist'
- 'phpcs.xml.dist'
- '.github/workflows/cs.yml'
- '.github/workflows/**'
# Allow manually triggering the workflow.
workflow_dispatch:

Expand All @@ -30,6 +30,10 @@ concurrency:
cancel-in-progress: true

jobs:
actionlint:
name: 'Lint GH Action workflows'
uses: Yoast/.github/.github/workflows/reusable-actionlint.yml@main

checkcs:
name: 'Check code style'
runs-on: ubuntu-latest
Expand All @@ -44,11 +48,11 @@ jobs:
BASE_REF: ${{ github.base_ref }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "NAME=$BASE_REF" >> $GITHUB_OUTPUT
echo "REF=origin/$BASE_REF" >> $GITHUB_OUTPUT
echo "NAME=$BASE_REF" >> "$GITHUB_OUTPUT"
echo "REF=origin/$BASE_REF" >> "$GITHUB_OUTPUT"
else
echo 'NAME=trunk' >> $GITHUB_OUTPUT
echo "REF=origin/trunk" >> $GITHUB_OUTPUT
echo 'NAME=trunk' >> "$GITHUB_OUTPUT"
echo "REF=origin/trunk" >> "$GITHUB_OUTPUT"
fi
- name: Fetch base branch
Expand Down Expand Up @@ -83,7 +87,7 @@ jobs:
set +e
composer check-cs-thresholds
exitcode="$?"
echo "EXITCODE=$exitcode" >> $GITHUB_OUTPUT
echo "EXITCODE=$exitcode" >> "$GITHUB_OUTPUT"
exit "$exitcode"
# Check the codestyle only of the files which were changed in the current branch.
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,22 @@ jobs:
SHA: ${{ github.sha }}
run: |
shortsha=$(echo "$SHA" | cut -b 1-6)
echo "SHORTSHA=$shortsha" >> $GITHUB_OUTPUT
echo "SHORTSHA=$shortsha" >> "$GITHUB_OUTPUT"
- name: "Set variables: target branch, commit title"
id: set_vars
env:
REF_NAME: ${{ github.ref_name }}
run: |
if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref_type }}" == 'branch' && "$REF_NAME" != "${{ env.DIST_DEFAULT_BRANCH }}" ]]; then
echo "BRANCH=$REF_NAME" >> $GITHUB_OUTPUT
echo "TITLE=Syncing branch $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> $GITHUB_OUTPUT
echo "BRANCH=$REF_NAME" >> "$GITHUB_OUTPUT"
echo "TITLE=Syncing branch $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> "$GITHUB_OUTPUT"
elif [[ "${{ github.event_name }}" == 'workflow_dispatch' && "$REF_NAME" != "${{ env.DIST_DEFAULT_BRANCH }}" ]]; then
echo "BRANCH=$REF_NAME" >> $GITHUB_OUTPUT
echo "TITLE=Manual deploy for $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> $GITHUB_OUTPUT
echo "BRANCH=$REF_NAME" >> "$GITHUB_OUTPUT"
echo "TITLE=Manual deploy for $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> "$GITHUB_OUTPUT"
else # = Pushed tag.
echo "BRANCH=${{ env.DIST_DEFAULT_BRANCH }}" >> $GITHUB_OUTPUT
echo "TITLE=Release $REF_NAME" >> $GITHUB_OUTPUT
echo "BRANCH=${{ env.DIST_DEFAULT_BRANCH }}" >> "$GITHUB_OUTPUT"
echo "TITLE=Release $REF_NAME" >> "$GITHUB_OUTPUT"
fi
- name: Checkout Yoast Dist repo
Expand Down Expand Up @@ -257,7 +257,7 @@ jobs:
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
env:
REF_NAME: ${{ github.ref_name }}
run: git tag "$REF_NAME" $(git rev-parse HEAD)
run: git tag "$REF_NAME" "$(git rev-parse HEAD)"

- name: Push to target branch
run: git push -u origin ${{ steps.set_vars.outputs.BRANCH }} --tags -v
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: none
tools: cs2pr
env:
update: true

- name: Lint against parse errors
run: composer lint -- --checkstyle | cs2pr
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ jobs:
php-version: ${{ matrix.php_version }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }}
env:
update: true

# The PHP platform requirement would prevent updating the test utilities to the appropriate versions.
# As long as the `composer update` is run selectively to only update the test utils, removing this is fine.
Expand Down Expand Up @@ -220,6 +222,8 @@ jobs:
php-version: ${{ matrix.php_version }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }}
env:
update: true

# The PHP platform requirement would prevent updating the test utilities to the appropriate versions.
# As long as the `composer update` is run selectively to only update the test utils, removing this is fine.
Expand Down
8 changes: 6 additions & 2 deletions apps/content-analysis-api/routes/research.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { Paper } = require( "yoastseo" );
const { build } = require( "yoastseo/build/parse/build" );
const { LanguageProcessor } = require( "yoastseo/build/parse/language" );
const { getResearcher } = require( "../helpers/get-researcher" );

module.exports = function( app ) {
Expand Down Expand Up @@ -45,10 +47,11 @@ module.exports = function( app ) {
request.body.text || "",
request.body || {}
);
paper.setTree( build( paper, new LanguageProcessor( researcher ), paper._attributes && paper._attributes.shortcodes ) );
researcher.setPaper( paper );
const sentenceLengths = researcher.getResearch( "countSentencesFromText" );

const responseBody = sentenceLengths.map( sentence => ( { sentence: sentence.sentence, length: sentence.sentenceLength } ) );
const responseBody = sentenceLengths.map( sentence => ( { sentence: sentence.sentence.text, length: sentence.sentenceLength } ) );
response.json( responseBody );
} );

Expand All @@ -59,10 +62,11 @@ module.exports = function( app ) {
request.body.text || "",
request.body || {}
);
paper.setTree( build( paper, new LanguageProcessor( researcher ), paper._attributes && paper._attributes.shortcodes ) );
researcher.setPaper( paper );
const paragraphLengths = researcher.getResearch( "getParagraphLength" );

const responseBody = paragraphLengths.map( paragraph => ( { paragraph: paragraph.text, length: paragraph.countLength } ) );
const responseBody = paragraphLengths.map( paragraph => ( { length: paragraph.paragraphLength } ) );
response.json( responseBody );
} );
}
2 changes: 1 addition & 1 deletion config/grunt/custom-tasks/sync-gutenberg-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = function( grunt ) {
*
* @returns {void}
*/
function setVersion( file, pattern, version ) {
function setVersion( file, pattern, version ) {
const contents = grunt.file.read( file ).replace(
pattern,
version
Expand Down
40 changes: 40 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import globals from "globals";
import yoastConfig from "eslint-config-yoast";

/** @type {import('eslint').Linter.Config[]} */
export default [
{ ignores: [ "js/dist", "packages", "apps", "artifact", "vendor", "vendor_prefixed", ".yarn" ] },
...yoastConfig,
{
languageOptions: {
ecmaVersion: "latest",
globals: {
...globals.browser,
},
},
rules: {
// Deviate from the Yoast config to prohibit dangling commas in functions.
"stylistic/comma-dangle": [
"error",
{
functions: "never",
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
exports: "always-multiline",
},
],

// Deviate from the Yoast config to allow for not using the error that is caught.
"no-unused-vars": [ "error", { caughtErrors: "none" } ],
},
},
{
files: [ "*.config.js", "config/**", "Gruntfile.js" ],
languageOptions: {
globals: {
...globals.node,
},
},
},
];
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@
"core-js": "^2.6.12",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"eslint": "^8.57.0",
"eslint-config-yoast": "^6.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.1",
"eslint": "^9.16.0",
"eslint-config-yoast": "^7.0.0",
"globals": "^15.13.0",
"grunt-git": "^1.0.14",
"grunt-prompt": "^1.3.3",
"grunt-shell": "^3.0.1",
Expand All @@ -77,7 +75,7 @@
"webpack-bundle-analyzer": "^4.9.1"
},
"yoast": {
"pluginVersion": "24.2-RC1"
"pluginVersion": "24.3-RC2"
},
"version": "0.0.0"
}
66 changes: 0 additions & 66 deletions packages/analysis-report/.eslintrc.js

This file was deleted.

Loading

0 comments on commit 1241e1e

Please sign in to comment.