2020-07-28 02:32:58 +00:00
|
|
|
module.exports = {
|
|
|
|
extends: [
|
|
|
|
'plugin:react-hooks/recommended',
|
|
|
|
require.resolve( './custom.js' ),
|
|
|
|
'plugin:@wordpress/eslint-plugin/recommended',
|
|
|
|
],
|
2021-02-10 21:52:39 +00:00
|
|
|
parser: '@typescript-eslint/parser',
|
2020-07-28 02:32:58 +00:00
|
|
|
globals: {
|
|
|
|
wcSettings: 'readonly',
|
2022-03-29 02:46:06 +00:00
|
|
|
'jest/globals': true,
|
|
|
|
jest: true,
|
2020-07-28 02:32:58 +00:00
|
|
|
},
|
|
|
|
plugins: [ '@wordpress' ],
|
|
|
|
rules: {
|
|
|
|
radix: 'error',
|
|
|
|
yoda: [ 'error', 'never' ],
|
2022-03-29 02:46:06 +00:00
|
|
|
// temporary conversion to warnings until the below are all handled.
|
|
|
|
'@wordpress/i18n-translator-comments': 'warn',
|
2022-07-08 10:37:30 +00:00
|
|
|
'@wordpress/i18n-text-domain': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
allowedTextDomain: 'woocommerce',
|
|
|
|
},
|
|
|
|
],
|
2022-03-29 02:46:06 +00:00
|
|
|
'@wordpress/valid-sprintf': 'warn',
|
|
|
|
'@wordpress/no-unsafe-wp-apis': 'warn',
|
|
|
|
'@wordpress/no-global-active-element': 'warn',
|
|
|
|
'import/no-extraneous-dependencies': 'warn',
|
|
|
|
'import/no-unresolved': 'warn',
|
|
|
|
'jest/no-deprecated-functions': 'warn',
|
|
|
|
'jest/valid-title': 'warn',
|
|
|
|
'jsdoc/check-tag-names': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
definedTags: [
|
|
|
|
'jest-environment',
|
|
|
|
'filter',
|
|
|
|
'action',
|
|
|
|
'slotFill',
|
|
|
|
'scope',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2022-06-29 08:56:31 +00:00
|
|
|
'@typescript-eslint/no-unused-vars': [
|
2022-03-29 02:46:06 +00:00
|
|
|
'error',
|
|
|
|
{
|
|
|
|
varsIgnorePattern: 'createElement',
|
2022-06-29 08:56:31 +00:00
|
|
|
ignoreRestSiblings: true,
|
2022-03-29 02:46:06 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
'react/react-in-jsx-scope': 'error',
|
2020-07-28 02:32:58 +00:00
|
|
|
},
|
2022-03-29 02:46:06 +00:00
|
|
|
settings: {
|
|
|
|
'import/resolver': 'typescript',
|
|
|
|
// List of modules that are externals in our webpack config.
|
|
|
|
'import/core-modules': [ '@woocommerce/settings', 'lodash', 'react' ],
|
|
|
|
react: {
|
|
|
|
pragma: 'createElement',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: [ '*.ts', '*.tsx' ],
|
|
|
|
extends: [ 'plugin:@typescript-eslint/recommended' ],
|
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
|
|
'@typescript-eslint/no-use-before-define': [ 'error' ],
|
|
|
|
'@typescript-eslint/no-shadow': [ 'error' ],
|
|
|
|
'@typescript-eslint/no-empty-function': 'off',
|
|
|
|
camelcase: 'off',
|
|
|
|
'no-use-before-define': 'off',
|
|
|
|
'jsdoc/require-param': 'off',
|
|
|
|
// Making use of typescript no-shadow instead, fixes issues with enum.
|
|
|
|
'no-shadow': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: [
|
|
|
|
'**/stories/*.js',
|
|
|
|
'**/stories/*.jsx',
|
|
|
|
'**/docs/example.js',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'react/react-in-jsx-scope': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2020-07-28 02:32:58 +00:00
|
|
|
};
|