Assorted configuration tweaks / code cleanup

This commit is contained in:
Michael Thomas 2022-01-22 22:19:32 -05:00
parent fc2f9df23c
commit 8e51f2ca38
7 changed files with 108 additions and 15 deletions

View File

@ -1,8 +1,13 @@
{ {
"root": true, "root": true,
"parser": "babel-eslint", "parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"react",
"jsx-a11y",
"jest"
],
"extends": [ "extends": [
"wordpress",
"plugin:react/recommended", "plugin:react/recommended",
"plugin:jsx-a11y/recommended", "plugin:jsx-a11y/recommended",
"plugin:jest/recommended" "plugin:jest/recommended"
@ -26,7 +31,6 @@
"window": true, "window": true,
"document": true "document": true
}, },
"plugins": ["react", "jsx-a11y", "jest"],
"settings": { "settings": {
"react": { "react": {
"pragma": "wp" "pragma": "wp"

View File

@ -33,6 +33,7 @@
"@wordpress/block-editor": "^8.0.13", "@wordpress/block-editor": "^8.0.13",
"@wordpress/blocks": "^11.1.5", "@wordpress/blocks": "^11.1.5",
"@wordpress/i18n": "^4.2.4", "@wordpress/i18n": "^4.2.4",
"@wordpress/icons": "^6.1.1",
"@wordpress/scripts": "^19.2.2", "@wordpress/scripts": "^19.2.2",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"react": "^17.0.2", "react": "^17.0.2",
@ -45,7 +46,10 @@
"webpack-cli": "^4.9.1" "webpack-cli": "^4.9.1"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"concurrently": "^7.0.0", "concurrently": "^7.0.0",
"eslint-plugin-jest": "^25.7.0",
"prettier": "^2.0.5", "prettier": "^2.0.5",
"sass": "^1.48.0", "sass": "^1.48.0",
"shx": "^0.3.4", "shx": "^0.3.4",

View File

@ -3,7 +3,6 @@
*/ */
import { registerBlockType } from '@wordpress/blocks'; import { registerBlockType } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
import { BlockAttributes } from './types'; import { BlockAttributes } from './types';
@ -15,13 +14,10 @@ import Save from './save';
import CogIcon from './assets/cogicon'; import CogIcon from './assets/cogicon';
registerBlockType<BlockAttributes> ( 'cognito-forms/cognito-embed', { registerBlockType<BlockAttributes>( 'cognito-forms/cognito-embed', {
title: 'Cognito Forms', title: 'Cognito Forms',
icon: CogIcon, icon: CogIcon,
description: __( description: 'Easily build powerful forms.',
'Easily build powerful forms.',
'cognito'
),
category: 'embed', category: 'embed',
supports: { supports: {
// Removes support for an HTML mode. // Removes support for an HTML mode.

View File

@ -16,8 +16,6 @@ const Save: React.FC<BlockSaveProps<BlockAttributes>> = ( { attributes: { formId
break; break;
} }
console.log(formId);
return ( return (
<div <div
className="cog-wp-embed" className="cog-wp-embed"

View File

@ -9,7 +9,8 @@
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": ["./src/*"]
} },
"resolveJsonModule": true
}, },
"include": [ "include": [
"src" "src"

View File

@ -18,13 +18,13 @@ module.exports = {
use: { use: {
loader: 'svg-react-loader', loader: 'svg-react-loader',
options: { options: {
jsx: true jsx: true,
}, },
}, },
}, },
{ {
test: /\.scss$/, test: /\.scss$/,
use: [ 'style-loader', 'sass-loader' ] use: [ 'style-loader', 'sass-loader' ],
}, },
...defaultConfig.module.rules, ...defaultConfig.module.rules,
], ],
@ -32,7 +32,10 @@ module.exports = {
resolve: { resolve: {
...defaultConfig.resolve, ...defaultConfig.resolve,
extensions: [ '.tsx', '.ts', 'js', 'jsx' ], alias: {
"@": path.resolve( __dirname, 'src' ),
},
extensions: [ '.tsx', '.ts', '.js', '.jsx' ],
}, },
output: { output: {

View File

@ -2482,6 +2482,21 @@
semver "^7.3.5" semver "^7.3.5"
tsutils "^3.21.0" tsutils "^3.21.0"
"@typescript-eslint/eslint-plugin@^5.10.0":
version "5.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz#e90afea96dff8620892ad216b0e4ccdf8ee32d3a"
integrity sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ==
dependencies:
"@typescript-eslint/scope-manager" "5.10.0"
"@typescript-eslint/type-utils" "5.10.0"
"@typescript-eslint/utils" "5.10.0"
debug "^4.3.2"
functional-red-black-tree "^1.0.1"
ignore "^5.1.8"
regexpp "^3.2.0"
semver "^7.3.5"
tsutils "^3.21.0"
"@typescript-eslint/eslint-plugin@^5.5.0": "@typescript-eslint/eslint-plugin@^5.5.0":
version "5.9.1" version "5.9.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.9.1.tgz#e5a86d7e1f9dc0b3df1e6d94feaf20dd838d066c" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.9.1.tgz#e5a86d7e1f9dc0b3df1e6d94feaf20dd838d066c"
@ -2531,6 +2546,16 @@
"@typescript-eslint/typescript-estree" "4.33.0" "@typescript-eslint/typescript-estree" "4.33.0"
debug "^4.3.1" debug "^4.3.1"
"@typescript-eslint/parser@^5.10.0":
version "5.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.10.0.tgz#8f59e036f5f1cffc178cacbd5ccdd02aeb96c91c"
integrity sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw==
dependencies:
"@typescript-eslint/scope-manager" "5.10.0"
"@typescript-eslint/types" "5.10.0"
"@typescript-eslint/typescript-estree" "5.10.0"
debug "^4.3.2"
"@typescript-eslint/parser@^5.5.0": "@typescript-eslint/parser@^5.5.0":
version "5.9.1" version "5.9.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.9.1.tgz#b114011010a87e17b3265ca715e16c76a9834cef" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.9.1.tgz#b114011010a87e17b3265ca715e16c76a9834cef"
@ -2549,6 +2574,14 @@
"@typescript-eslint/types" "4.33.0" "@typescript-eslint/types" "4.33.0"
"@typescript-eslint/visitor-keys" "4.33.0" "@typescript-eslint/visitor-keys" "4.33.0"
"@typescript-eslint/scope-manager@5.10.0":
version "5.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz#bb5d872e8b9e36203908595507fbc4d3105329cb"
integrity sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg==
dependencies:
"@typescript-eslint/types" "5.10.0"
"@typescript-eslint/visitor-keys" "5.10.0"
"@typescript-eslint/scope-manager@5.9.1": "@typescript-eslint/scope-manager@5.9.1":
version "5.9.1" version "5.9.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.9.1.tgz#6c27be89f1a9409f284d95dfa08ee3400166fe69" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.9.1.tgz#6c27be89f1a9409f284d95dfa08ee3400166fe69"
@ -2557,6 +2590,15 @@
"@typescript-eslint/types" "5.9.1" "@typescript-eslint/types" "5.9.1"
"@typescript-eslint/visitor-keys" "5.9.1" "@typescript-eslint/visitor-keys" "5.9.1"
"@typescript-eslint/type-utils@5.10.0":
version "5.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz#8524b9479c19c478347a7df216827e749e4a51e5"
integrity sha512-TzlyTmufJO5V886N+hTJBGIfnjQDQ32rJYxPaeiyWKdjsv2Ld5l8cbS7pxim4DeNs62fKzRSt8Q14Evs4JnZyQ==
dependencies:
"@typescript-eslint/utils" "5.10.0"
debug "^4.3.2"
tsutils "^3.21.0"
"@typescript-eslint/type-utils@5.9.1": "@typescript-eslint/type-utils@5.9.1":
version "5.9.1" version "5.9.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.9.1.tgz#c6832ffe655b9b1fec642d36db1a262d721193de" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.9.1.tgz#c6832ffe655b9b1fec642d36db1a262d721193de"
@ -2571,6 +2613,11 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72"
integrity sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ== integrity sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==
"@typescript-eslint/types@5.10.0":
version "5.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.0.tgz#beb3cb345076f5b088afe996d57bcd1dfddaa75c"
integrity sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ==
"@typescript-eslint/types@5.9.1": "@typescript-eslint/types@5.9.1":
version "5.9.1" version "5.9.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.9.1.tgz#1bef8f238a2fb32ebc6ff6d75020d9f47a1593c6" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.9.1.tgz#1bef8f238a2fb32ebc6ff6d75020d9f47a1593c6"
@ -2589,6 +2636,19 @@
semver "^7.3.5" semver "^7.3.5"
tsutils "^3.21.0" tsutils "^3.21.0"
"@typescript-eslint/typescript-estree@5.10.0":
version "5.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz#4be24a3dea0f930bb1397c46187d0efdd955a224"
integrity sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA==
dependencies:
"@typescript-eslint/types" "5.10.0"
"@typescript-eslint/visitor-keys" "5.10.0"
debug "^4.3.2"
globby "^11.0.4"
is-glob "^4.0.3"
semver "^7.3.5"
tsutils "^3.21.0"
"@typescript-eslint/typescript-estree@5.9.1": "@typescript-eslint/typescript-estree@5.9.1":
version "5.9.1" version "5.9.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.9.1.tgz#d5b996f49476495070d2b8dd354861cf33c005d6" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.9.1.tgz#d5b996f49476495070d2b8dd354861cf33c005d6"
@ -2602,6 +2662,18 @@
semver "^7.3.5" semver "^7.3.5"
tsutils "^3.21.0" tsutils "^3.21.0"
"@typescript-eslint/utils@5.10.0":
version "5.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.10.0.tgz#c3d152a85da77c400e37281355561c72fb1b5a65"
integrity sha512-IGYwlt1CVcFoE2ueW4/ioEwybR60RAdGeiJX/iDAw0t5w0wK3S7QncDwpmsM70nKgGTuVchEWB8lwZwHqPAWRg==
dependencies:
"@types/json-schema" "^7.0.9"
"@typescript-eslint/scope-manager" "5.10.0"
"@typescript-eslint/types" "5.10.0"
"@typescript-eslint/typescript-estree" "5.10.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
"@typescript-eslint/visitor-keys@4.33.0": "@typescript-eslint/visitor-keys@4.33.0":
version "4.33.0" version "4.33.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz#2a22f77a41604289b7a186586e9ec48ca92ef1dd" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz#2a22f77a41604289b7a186586e9ec48ca92ef1dd"
@ -2610,6 +2682,14 @@
"@typescript-eslint/types" "4.33.0" "@typescript-eslint/types" "4.33.0"
eslint-visitor-keys "^2.0.0" eslint-visitor-keys "^2.0.0"
"@typescript-eslint/visitor-keys@5.10.0":
version "5.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz#770215497ad67cd15a572b52089991d5dfe06281"
integrity sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ==
dependencies:
"@typescript-eslint/types" "5.10.0"
eslint-visitor-keys "^3.0.0"
"@typescript-eslint/visitor-keys@5.9.1": "@typescript-eslint/visitor-keys@5.9.1":
version "5.9.1" version "5.9.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.9.1.tgz#f52206f38128dd4f675cf28070a41596eee985b7" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.9.1.tgz#f52206f38128dd4f675cf28070a41596eee985b7"
@ -5838,6 +5918,13 @@ eslint-plugin-jest@^25.3.0:
dependencies: dependencies:
"@typescript-eslint/experimental-utils" "^5.0.0" "@typescript-eslint/experimental-utils" "^5.0.0"
eslint-plugin-jest@^25.7.0:
version "25.7.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-25.7.0.tgz#ff4ac97520b53a96187bad9c9814e7d00de09a6a"
integrity sha512-PWLUEXeeF7C9QGKqvdSbzLOiLTx+bno7/HC9eefePfEb257QFHg7ye3dh80AZVkaa/RQsBB1Q/ORQvg2X7F0NQ==
dependencies:
"@typescript-eslint/experimental-utils" "^5.0.0"
eslint-plugin-jsdoc@^36.0.8: eslint-plugin-jsdoc@^36.0.8:
version "36.1.1" version "36.1.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-36.1.1.tgz#124cd0e53a5d07f01ebde916a96dd1a6009625d6" resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-36.1.1.tgz#124cd0e53a5d07f01ebde916a96dd1a6009625d6"