Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBatdorf committed Sep 29, 2024
1 parent 48cf2db commit 03b07a4
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
trailingComma: 'all',
tabWidth: 4,
semi: true,
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/themes.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import themes from '../../src/defaultThemes.json';

const { MORE_THEMES_URL } = require('../constants');
import { MORE_THEMES_URL } from '../constants';

beforeEach(() => {
cy.resetDatabase();
Expand Down
192 changes: 105 additions & 87 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,105 +1,123 @@
import { fixupConfigRules } from "@eslint/compat";
import noOnlyTests from "eslint-plugin-no-only-tests";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import { fixupConfigRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import tsParser from '@typescript-eslint/parser';
import noOnlyTests from 'eslint-plugin-no-only-tests';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
allConfig: js.configs.all,
});

export default [{
ignores: ["**/node_modules/", "**/pkg/", "**/build/"],
}, ...fixupConfigRules(compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
"plugin:cypress/recommended",
"prettier",
)), {
plugins: {
"no-only-tests": noOnlyTests,
export default [
{
ignores: ['**/node_modules/', '**/build/', 'postcss.config.js'],
},

languageOptions: {
globals: {
...globals.browser,
...globals.jest,
...globals.node,
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:cypress/recommended',
'prettier',
),
),
{
plugins: {
'no-only-tests': noOnlyTests,
},

parser: tsParser,
ecmaVersion: 5,
sourceType: "module",
languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: 'module',

parserOptions: {
ecmaFeatures: {
jsx: true,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},

allowImportExportEverywhere: true,
allowImportExportEverywhere: true,
},
},
},

settings: {
react: {
version: "detect",
settings: {
react: {
version: 'detect',
},
},
},

rules: {
"require-await": "error",

quotes: ["error", "single", {
avoidEscape: true,
}],

"comma-dangle": ["error", "always-multiline"],
"array-element-newline": ["error", "consistent"],

"no-constant-condition": ["error", {
checkLoops: true,
}],

"no-multi-spaces": ["error"],
semi: ["error", "always"],
"space-in-parens": ["error", "never"],

"key-spacing": ["error", {
afterColon: true,
}],

"no-only-tests/no-only-tests": "warn",
"space-infix-ops": ["error"],

"space-before-function-paren": ["error", {
anonymous: "always",
named: "never",
asyncArrow: "always",
}],

"react/react-in-jsx-scope": "off",
"quote-props": ["error", "as-needed"],

"no-multiple-empty-lines": ["error", {
max: 1,
}],

"@typescript-eslint/no-var-requires": "off",

"lines-around-comment": ["error", {
beforeBlockComment: true,
allowBlockStart: true,
}],
rules: {
'require-await': 'error',

quotes: [
'error',
'single',
{
avoidEscape: true,
},
],

'comma-dangle': ['error', 'always-multiline'],
'array-element-newline': ['error', 'consistent'],

'no-constant-condition': [
'error',
{
checkLoops: true,
},
],

'no-multi-spaces': ['error'],
semi: ['error', 'always'],
'space-in-parens': ['error', 'never'],

'key-spacing': [
'error',
{
afterColon: true,
},
],

'no-only-tests/no-only-tests': 'warn',
'space-infix-ops': ['error'],

'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
},
],

'react/react-in-jsx-scope': 'off',
'quote-props': ['error', 'as-needed'],

'no-multiple-empty-lines': [
'error',
{
max: 1,
},
],

'@typescript-eslint/no-var-requires': 'off',

'lines-around-comment': [
'error',
{
beforeBlockComment: true,
allowBlockStart: true,
},
],
},
},
}];
];
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"webpack": "^5.95.0"
},
"dependencies": {
"@eslint/compat": "^1.1.1",
"@headlessui/react": "2.1.8",
"@wordpress/block-editor": "14.3.0",
"@wordpress/blocks": "13.8.0",
Expand Down
1 change: 1 addition & 0 deletions src/editor/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export const Edit = ({
getBlurs,
getHighlights,
useDecodeURI,
useEscapeShortCodes,
]);

useLayoutEffect(() => {
Expand Down
1 change: 1 addition & 0 deletions src/util/arrayHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const parseJSONArrayWithRanges = (
.filter((inner: number) => inner >= 0)
);
} catch (e) {
console.error(e);
return [];
}
};
Expand Down
2 changes: 2 additions & 0 deletions src/util/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const encode = (code: string, { useDecodeURI }: Partial<Attributes>) => {
// Here for bw compatability
return encodeURIComponent(code);
} catch (e) {
console.error(e);
return code;
}
}
Expand All @@ -20,6 +21,7 @@ export const decode = (code: string, { useDecodeURI }: Partial<Attributes>) => {
// Here for bw compatability
return decodeURIComponent(code);
} catch (e) {
console.error(e);
return code;
}
}
Expand Down
17 changes: 9 additions & 8 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const colors = require('tailwindcss/colors');
import { colors } from 'tailwindcss/colors';

delete colors['lightBlue'];
delete colors['warmGray'];
delete colors['trueGray'];
delete colors['coolGray'];
delete colors['blueGray'];

// See postcss.config.js for more parsing options.
module.exports = {
export default {
// Tnis should match the namespace you use in your css styles.
important: '.code-block-pro',
theme: {
Expand Down Expand Up @@ -46,20 +47,20 @@ module.exports = {
gray: {
50: '#fbfbfb',
100: '#f0f0f0',
150: '#eaeaea', // This wasn't a variable but I saw it on buttons
200: '#e0e0e0', // Used sparingly for light borders.
300: '#dddddd', // Used for most borders.
150: '#eaeaea',
200: '#e0e0e0',
300: '#dddddd',
400: '#cccccc',
500: '#cccccc',
600: '#949494', // Meets 3:1 UI or large text contrast against white.
700: '#757575', // Meets 4.6:1 text contrast against white.
600: '#949494',
700: '#757575',
900: '#1e1e1e',
},
},
extend: {
zIndex: {
high: '99999',
max: '2147483647', // max int values - don't block WP re-auth modal
max: '2147483647',
},
ringWidth: {
wp: 'var(--wp-admin-border-width-focus)',
Expand Down
10 changes: 3 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
const CopyPlugin = require('copy-webpack-plugin');
import defaultConfig from '@wordpress/scripts/config/webpack.config';
import CopyPlugin from 'copy-webpack-plugin';

module.exports = {
export default {
...defaultConfig,
devServer: {
...defaultConfig.devServer,
host: 'wordpress.test',
},
plugins: [
...defaultConfig.plugins,
new CopyPlugin({
Expand Down

0 comments on commit 03b07a4

Please sign in to comment.