Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal (ckeditor5): Upgrade eslint to v8. #16047

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"chalk": "^4.1.0",
"coveralls": "^3.1.0",
"date-fns": "^2.30.0",
"eslint": "^7.19.0",
"eslint": "^8.57.0",
"eslint-config-ckeditor5": "^5.3.0",
"fs-extra": "^11.1.1",
"glob": "^10.2.5",
Expand Down
12 changes: 8 additions & 4 deletions scripts/eslint-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,24 @@
/* eslint-env node */

// See: https://eslint.org/docs/user-guide/formatters/#stylish.
const eslintStylishFormatter = require( 'eslint/lib/cli-engine/formatters/stylish' );
const chalk = require( 'chalk' );
const { ESLint } = require( 'eslint' );

// eslint-disable-next-line max-len
const CODE_STYLE_URL = 'https://ckeditor.com/docs/ckeditor5/latest/framework/contributing/code-style.html#ckeditor-5-custom-eslint-rules';
const CODE_STYLE_URL =
'https://ckeditor.com/docs/ckeditor5/latest/framework/contributing/code-style.html#ckeditor-5-custom-eslint-rules';

/**
* Overwrite the default ESLint formatter. If CKEditor 5 related error occurred,
* let's print a URL to the documentation where all custom rules are explained.
*
* @param {Array} results
*/
module.exports = results => {
console.log( eslintStylishFormatter( results ) );
module.exports = async results => {
const eslint = new ESLint();
const stylish = await eslint.loadFormatter();

console.log( stylish.format( results ) );

const hasCKEditorErrors = results.some( item => {
if ( !Array.isArray( item.messages ) ) {
Expand Down