Skip to content

Commit

Permalink
Restore rule that prevents having to build all js before linting
Browse files Browse the repository at this point in the history
  • Loading branch information
diedexx committed Dec 16, 2024
1 parent 2072c8e commit 49c0bf3
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 7 deletions.
14 changes: 14 additions & 0 deletions packages/analysis-report/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ export default [
},
},
rules: {
// Account for webpack externals and potentially unbuilt packages in the monorepo setup.
"import/no-unresolved": [
"error",
{
ignore: [
// Ignore @yoast packages from this workspace, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js`, which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
"yoastseo",
],
},
],

// Deviate from the Yoast config to prohibit dangling commas in functions.
"stylistic/comma-dangle": [
"error",
Expand Down
14 changes: 14 additions & 0 deletions packages/components/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ export default [
},
},
rules: {
// Account for webpack externals and potentially unbuilt packages in the monorepo setup.
"import/no-unresolved": [
"error",
{
ignore: [
// Ignore @yoast packages from this workspace, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js`, which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
"yoastseo",
],
},
],

// Deviate from the Yoast config to prohibit dangling commas in functions.
"stylistic/comma-dangle": [
"error",
Expand Down
9 changes: 5 additions & 4 deletions packages/js/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ export default [
ignore: [
// This is our internal externals used within `packages/js`, not actually a package.
"^@yoast/externals/(components|contexts|redux)$",
// Ignore UI library and schema-blocks, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js` (in the UI library), which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|schema-blocks|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
// Externals provided by @wordpress/dependency-extraction-webpack-plugin
"^@wordpress/(annotations|api|edit-post|sanitize)$",
"^jquery$",
// Ignore @yoast packages from this workspace, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js`, which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
"yoastseo",
],
},
Expand Down
14 changes: 14 additions & 0 deletions packages/related-keyphrase-suggestions/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ export default [
},
},
rules: {
// Account for webpack externals and potentially unbuilt packages in the monorepo setup.
"import/no-unresolved": [
"error",
{
ignore: [
// Ignore @yoast packages from this workspace, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js`, which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
"yoastseo",
],
},
],

// Deviate from the Yoast config to allow use of short-circuit and ternary expressions to call functions with side effects, like setState.
"no-unused-expressions": [
"error",
Expand Down
14 changes: 14 additions & 0 deletions packages/replacement-variable-editor/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ export default [
},
},
rules: {
// Account for webpack externals and potentially unbuilt packages in the monorepo setup.
"import/no-unresolved": [
"error",
{
ignore: [
// Ignore @yoast packages from this workspace, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js`, which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
"yoastseo",
],
},
],

// Deviate from the Yoast config to prohibit dangling commas in functions.
"stylistic/comma-dangle": [
"error",
Expand Down
14 changes: 14 additions & 0 deletions packages/search-metadata-previews/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ export default [
},
},
rules: {
// Account for webpack externals and potentially unbuilt packages in the monorepo setup.
"import/no-unresolved": [
"error",
{
ignore: [
// Ignore @yoast packages from this workspace, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js`, which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
"yoastseo",
],
},
],

// Deviate from the Yoast config to prohibit dangling commas in functions.
"stylistic/comma-dangle": [
"error",
Expand Down
14 changes: 14 additions & 0 deletions packages/social-metadata-forms/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ export default [
},
},
rules: {
// Account for webpack externals and potentially unbuilt packages in the monorepo setup.
"import/no-unresolved": [
"error",
{
ignore: [
// Ignore @yoast packages from this workspace, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js`, which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
"yoastseo",
],
},
],

// Deviate from the Yoast config to prohibit dangling commas in functions.
"stylistic/comma-dangle": [
"error",
Expand Down
14 changes: 14 additions & 0 deletions packages/social-metadata-previews/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ export default [
},
},
rules: {
// Account for webpack externals and potentially unbuilt packages in the monorepo setup.
"import/no-unresolved": [
"error",
{
ignore: [
// Ignore @yoast packages from this workspace, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js`, which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
"yoastseo",
],
},
],

// Deviate from the Yoast config to prohibit dangling commas in functions.
"stylistic/comma-dangle": [
"error",
Expand Down
19 changes: 16 additions & 3 deletions packages/yoastseo/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ export default [
},
},
rules: {
// Account for webpack externals and potentially unbuilt packages in the monorepo setup.
"import/no-unresolved": [
"error",
{
ignore: [
// Ignore @yoast packages from this workspace, or we have to build the code before linting.
// Because `main` in `package.json` points to the `build/index.js`, which is not present before building.
// As we are dealing with our source, not the actual NPM download, due to the monorepo setup.
"^@yoast/(ui-library|style-guide|components|helpers|search-metadata-previews|social-metadata-forms|replacement-variable-editor|analysis-report|feature-flag|related-keyphrase-suggestions)$",
"yoastseo",
// Ignore imports from premium-configuration, which might not be available in all environments.
"premium-configuration/data/morphologyData",
],
},
],

// Deviate from the Yoast config to prohibit dangling commas in functions.
"stylistic/comma-dangle": [
"error",
Expand Down Expand Up @@ -45,9 +61,6 @@ export default [
// We sometimes export a value as both a named export and a default export.
"import/no-named-as-default": "off",

// Deviate from the Yoast config to ignore imports from premium-configuration, which might not be available in all environments.
"import/no-unresolved": [ "error", { ignore: [ "premium-configuration/data/morphologyData" ] } ],

// Deviate from the Yoast config to allow for not using the error that is caught.
"no-unused-vars": [ "error", { caughtErrors: "none" } ],
},
Expand Down

0 comments on commit 49c0bf3

Please sign in to comment.