Add .eslintrc config to each packages

Update packages .eslintrc.js

Update components & admin-e2e-tests lint command
This commit is contained in:
Chi-Hsuan Huang 2022-03-28 18:39:16 +08:00
parent 68786f8e72
commit 81a1f4244a
22 changed files with 94 additions and 75 deletions

View File

@ -1,73 +0,0 @@
module.exports = {
env: {
'jest/globals': true,
},
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
settings: {
'import/resolver': 'typescript',
// List of modules that are externals in our webpack config.
'import/core-modules': [ '@woocommerce/settings', 'lodash', 'react' ],
react: {
pragma: 'createElement',
},
},
rules: {
// temporary conversion to warnings until the below are all handled.
'@wordpress/i18n-translator-comments': 'warn',
'@wordpress/valid-sprintf': 'warn',
'jsdoc/check-tag-names': [
'error',
{
definedTags: [
'jest-environment',
'filter',
'action',
'slotFill',
'scope',
],
},
],
'jsdoc/tag-lines': 'off',
'jest/no-deprecated-functions': 'warn',
'jest/valid-title': 'warn',
'@wordpress/no-global-active-element': 'warn',
'no-unused-vars': [
'error',
{
varsIgnorePattern: 'createElement',
},
],
'react/react-in-jsx-scope': 'error',
},
overrides: [
{
files: [ '*.ts', '*.tsx' ],
parser: '@typescript-eslint/parser',
extends: [
'plugin:@woocommerce/eslint-plugin/recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
camelcase: 'off',
'@typescript-eslint/no-explicit-any': 'error',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [ 'error' ],
'jsdoc/require-param': 'off',
// Making use of typescript no-shadow instead, fixes issues with enum.
'no-shadow': 'off',
'@typescript-eslint/no-shadow': [ 'error' ],
'@typescript-eslint/no-empty-function': 'off',
},
},
{
files: [
'**/stories/*.js',
'**/stories/*.jsx',
'**/docs/example.js',
],
rules: {
'react/react-in-jsx-scope': 'off',
},
},
],
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,19 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
overrides: [
{
files: [
'**/stories/*.js',
'**/stories/*.jsx',
'**/docs/example.js',
],
rules: {
'import/no-unresolved': [
'warn',
{ ignore: [ '@woocommerce/components' ] },
],
},
},
],
};

View File

@ -115,7 +115,7 @@
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"build:css": "webpack",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"lint": "eslint src",
"lint": "eslint src --ext=js,ts,tsx",
"prepack": "pnpm run clean && pnpm run build",
"start": "concurrently \"tsc --build ./tsconfig.json --watch\" \"webpack --watch\"",
"test": "pnpm run build && pnpm run test:nobuild",

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -25,6 +25,8 @@
},
"devDependencies": {
"@babel/core": "^7.17.5",
"@wordpress/eslint-plugin": "^11.0.0",
"eslint": "^8.12.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -28,7 +28,6 @@
"dependencies": {
"@typescript-eslint/parser": "^5.14.0",
"@wordpress/eslint-plugin": "^11.0.0",
"eslint": "^8.10.0",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-testing-library": "^5.1.0",
"requireindex": "^1.2.0"
@ -36,8 +35,12 @@
"publishConfig": {
"access": "public"
},
"scripts": {
"lint": "eslint ./rules ./configs"
},
"devDependencies": {
"@babel/core": "^7.17.5",
"eslint": "^8.11.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};