Skip to content

Commit

Permalink
fix: Remove name from eslint/js packages (#18368)
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Apr 19, 2024
1 parent 155c71c commit 8d18958
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
9 changes: 8 additions & 1 deletion packages/js/src/configs/eslint-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@

/* eslint quote-props: off -- autogenerated so don't lint */

/*
* IMPORTANT!
*
* We cannot add a "name" property to this object because it's still used in eslintrc
* which doesn't support the "name" property. If we add a "name" property, it will
* cause an error.
*/

module.exports = Object.freeze({
"name": "@eslint/js/all",
"rules": {
"accessor-pairs": "error",
"array-callback-return": "error",
Expand Down
9 changes: 8 additions & 1 deletion packages/js/src/configs/eslint-recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@

/* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */

/*
* IMPORTANT!
*
* We cannot add a "name" property to this object because it's still used in eslintrc
* which doesn't support the "name" property. If we add a "name" property, it will
* cause an error.
*/

module.exports = Object.freeze({
name: "@eslint/js/recommended",
rules: Object.freeze({
"constructor-super": "error",
"for-direction": "error",
Expand Down
10 changes: 9 additions & 1 deletion tools/update-eslint-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ const code = `/*
/* eslint quote-props: off -- autogenerated so don't lint */
module.exports = Object.freeze(${JSON.stringify({ name: "@eslint/js/all", rules: allRules }, null, 4)});
/*
* IMPORTANT!
*
* We cannot add a "name" property to this object because it's still used in eslintrc
* which doesn't support the "name" property. If we add a "name" property, it will
* cause an error.
*/
module.exports = Object.freeze(${JSON.stringify({ rules: allRules }, null, 4)});
`;

fs.writeFileSync("./packages/js/src/configs/eslint-all.js", code, "utf8");

0 comments on commit 8d18958

Please sign in to comment.