-
Notifications
You must be signed in to change notification settings - Fork 908
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18319 from Yoast/P1-1277-implement-es-lint-babel-…
…tooling-standards-in-js-package P1-1277 - Implement tooling standards in js package
- Loading branch information
Showing
16 changed files
with
564 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
module.exports = ( api ) => { | ||
api.cache( true ); | ||
|
||
return { | ||
presets: [ "@wordpress/babel-preset-default" ], | ||
plugins: [ "@babel/plugin-transform-runtime" ], | ||
sourceType: "unambiguous", | ||
}; | ||
module.exports = { | ||
presets: [ "@yoast/babel-preset" ], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extends @yoast/browserslist-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
module.exports = { | ||
root: true, | ||
"extends": [ | ||
"yoast", | ||
], | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
parser: "@babel/eslint-parser", | ||
parserOptions: { | ||
ecmaVersion: 2019, | ||
sourceType: "module", | ||
}, | ||
plugins: [ | ||
"@babel", | ||
"jest", | ||
], | ||
env: { | ||
"jest/globals": true, | ||
}, | ||
rules: { | ||
"no-prototype-builtins": 0, | ||
"comma-dangle": [ | ||
"error", | ||
{ | ||
arrays: "always-multiline", | ||
objects: "always-multiline", | ||
imports: "always-multiline", | ||
exports: "always-multiline", | ||
functions: "never", | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
{ | ||
files: [ "**/*.js" ], | ||
rules: { | ||
// Custom rules: only for temporary exceptions that should be removed over time | ||
camelcase: 1, | ||
complexity: [ 1, 6 ], | ||
"brace-style": 1, | ||
"max-statements": 1, | ||
"no-shadow": 1, | ||
"require-jsdoc": 1, | ||
"react/jsx-no-bind": 1, | ||
"react/jsx-no-target-blank": 1, | ||
"react/no-access-state-in-setstate": 1, | ||
"react/no-deprecated": 1, | ||
"react/no-unused-prop-types": 1, | ||
"react/prop-types": 1, | ||
"react/require-default-props": 1, | ||
"no-restricted-imports": [ | ||
"error", | ||
{ | ||
name: "react", | ||
message: "Please use @wordpress/element instead. No need to import just for JSX.", | ||
|
||
}, | ||
{ | ||
name: "react-dom", | ||
message: "Please use @wordpress/element instead.", | ||
}, | ||
|
||
], | ||
|
||
// Disabled rules | ||
// In the editor, we're using the pragma `wp.element.createElement` | ||
"react/react-in-jsx-scope": 0, | ||
}, | ||
|
||
}, | ||
{ | ||
files: [ "tests/**/*.js" ], | ||
rules: { | ||
"no-restricted-imports": 0, | ||
"no-undefined": 0, | ||
"react/display-name": 0, | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Editor | ||
.vscode | ||
.idea | ||
# Dependencies | ||
node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
presets: [ "@yoast/babel-preset" ], | ||
env: { | ||
test: { | ||
plugins: [ | ||
"babel-plugin-styled-components", | ||
], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
preset: "@yoast/jest-preset", | ||
setupFilesAfterEnv: [ "<rootDir>/tests/setupTests.js" ], | ||
testPathIgnorePatterns: [ | ||
"/tests/__mocks__/", | ||
"/tests/containers/mockSelectors.js", | ||
"/tests/helpers/factory.js", | ||
"/tests/setupTests.js", | ||
"/tests/decorator/__mocks__/@wordpress/rich-text/index.js", | ||
], | ||
|
||
moduleNameMapper: { | ||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/tests/__mocks__/fileMock.js", | ||
"\\.(css|less)$": "<rootDir>/tests/__mocks__/styleMock.js", | ||
"find-with-regex": "<rootDir>/node_modules/find-with-regex/lib/index.js", | ||
"^lodash-es$": "lodash", | ||
"^lodash-es/(.*)$": "lodash/$1", | ||
}, | ||
moduleDirectories: [ | ||
"<rootDir>/node_modules", | ||
"node_modules", | ||
], | ||
snapshotSerializers: [ | ||
"enzyme-to-json/serializer", | ||
], | ||
testURL: "http://localhost/", | ||
}; |
Oops, something went wrong.