Skip to content

Commit

Permalink
Merge branch 'main' into fix-test-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
huwshimi authored Sep 19, 2024
2 parents e252646 + 47d1030 commit 5ea22b2
Show file tree
Hide file tree
Showing 129 changed files with 2,638 additions and 3,959 deletions.
80 changes: 0 additions & 80 deletions .eslintrc.js

This file was deleted.

134 changes: 134 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import prettier from "eslint-plugin-prettier";
import cypress from "eslint-plugin-cypress";
import testingLibrary from "eslint-plugin-testing-library";
import babelParser from "@babel/eslint-parser";
import path from "node:path";
import tseslint from "typescript-eslint";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import react from "eslint-plugin-react";
import hooksPlugin from "eslint-plugin-react-hooks";

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,
});

export default [
...fixupConfigRules(
compat.extends("plugin:cypress/recommended", "plugin:prettier/recommended"),
),
...tseslint.configs.recommended,
react.configs.flat.recommended,
{
plugins: {
"react-hooks": fixupPluginRules(hooksPlugin),
},
rules: hooksPlugin.configs.recommended.rules,
},
{
plugins: {
prettier: fixupPluginRules(prettier),
cypress: fixupPluginRules(cypress),
"@typescript-eslint": tseslint.plugin,
},
languageOptions: {
parser: babelParser,
ecmaVersion: 2018,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: "detect",
},
},
rules: {
"react/forbid-component-props": [
"error",
{
forbid: [
{
propName: "data-test",
message: "Use `data-testid` instead of `data-test` attribute",
},
],
},
],
"react/forbid-dom-props": [
"error",
{
forbid: [
{
propName: "data-test",
message: "Use `data-testid` instead of `data-test` attribute",
},
],
},
],
"react/display-name": "off",
"react/prop-types": "off",
"react/no-unescaped-entities": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
},
},
...fixupConfigRules(compat.extends("plugin:prettier/recommended")).map(
(config) => ({
...config,
files: ["**/*.ts?(x)"],
}),
),
{
files: ["**/*.ts?(x)"],
languageOptions: {
parser: tseslint.parser,
ecmaVersion: 2018,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: "detect",
},
},
rules: {
"prettier/prettier": "error",
},
},
{
plugins: {
"testing-library": fixupPluginRules({
rules: testingLibrary.rules,
}),
},
files: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
rules: {
...testingLibrary.configs["flat/react"].rules,
"testing-library/no-node-access": "off",
"testing-library/no-container": "off",
"testing-library/no-render-in-lifecycle": "off",
},
},
];
100 changes: 51 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,78 +25,82 @@
},
"homepage": "https://canonical.github.io/react-components",
"devDependencies": {
"@babel/cli": "7.24.5",
"@babel/eslint-parser": "7.24.5",
"@babel/preset-typescript": "7.24.1",
"@percy/cli": "1.28.8",
"@percy/storybook": "6.0.0",
"@babel/cli": "7.25.6",
"@babel/eslint-parser": "7.25.1",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/preset-react": "7.24.7",
"@babel/preset-typescript": "7.24.7",
"@eslint/compat": "1.1.1",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.9.1",
"@percy/cli": "1.29.3",
"@percy/storybook": "6.0.2",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"@storybook/addon-a11y": "8.1.11",
"@storybook/addon-essentials": "8.1.11",
"@storybook/addon-interactions": "8.1.11",
"@storybook/addon-links": "8.1.11",
"@storybook/addon-onboarding": "8.1.11",
"@storybook/addon-a11y": "8.2.9",
"@storybook/addon-essentials": "8.2.9",
"@storybook/addon-interactions": "8.2.9",
"@storybook/addon-links": "8.2.9",
"@storybook/addon-onboarding": "8.2.9",
"@storybook/addon-webpack5-compiler-babel": "3.0.3",
"@storybook/blocks": "8.1.11",
"@storybook/react": "8.1.11",
"@storybook/react-webpack5": "8.1.11",
"@testing-library/cypress": "10.0.1",
"@testing-library/dom": "10.1.0",
"@testing-library/jest-dom": "6.4.5",
"@testing-library/react": "15.0.7",
"@storybook/blocks": "8.2.9",
"@storybook/react": "8.2.9",
"@storybook/react-webpack5": "8.2.9",
"@testing-library/cypress": "10.0.2",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "6.5.0",
"@testing-library/react": "16.0.1",
"@testing-library/user-event": "14.5.2",
"@types/lodash.isequal": "4",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",
"babel-jest": "29.7.0",
"babel-loader": "9.1.3",
"babel-plugin-module-resolver": "5.0.2",
"babel-plugin-typescript-to-proptypes": "2.1.0",
"concurrently": "8.2.2",
"css-loader": "7.1.1",
"cypress": "13.9.0",
"css-loader": "7.1.2",
"cypress": "13.14.1",
"deepmerge": "4.3.1",
"eslint": "8.57.0",
"eslint": "9.9.1",
"eslint-config-prettier": "9.1.0",
"eslint-config-react-app": "7.0.1",
"eslint-plugin-cypress": "3.2.0",
"eslint-plugin-cypress": "3.5.0",
"eslint-plugin-flowtype": "8.0.3",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react": "7.34.1",
"eslint-plugin-jsx-a11y": "6.9.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.35.2",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-storybook": "0.8.0",
"eslint-plugin-testing-library": "6.2.2",
"eslint-plugin-testing-library": "6.3.0",
"formik": "2.4.6",
"jest": "29.7.0",
"npm-package-json-lint": "7.1.0",
"prettier": "3.2.5",
"npm-package-json-lint": "8.0.0",
"prettier": "3.3.3",
"react": "18.3.1",
"react-docgen-typescript-loader": "3.7.2",
"react-dom": "18.3.1",
"sass": "1.77.0",
"sass-loader": "14.2.1",
"semantic-release": "23.0.8",
"storybook": "8.1.11",
"sass": "1.77.8",
"sass-loader": "16.0.1",
"semantic-release": "24.1.0",
"storybook": "8.2.9",
"strip-ansi": "7.1.0",
"style-loader": "4.0.0",
"stylelint": "16.5.0",
"stylelint": "16.9.0",
"stylelint-config-prettier": "9.0.5",
"stylelint-config-recommended-scss": "14.0.0",
"stylelint-config-recommended-scss": "14.1.0",
"stylelint-order": "6.0.4",
"stylelint-prettier": "5.0.0",
"ts-jest": "29.1.2",
"tsc-alias": "1.8.8",
"typescript": "5.4.5",
"stylelint-prettier": "5.0.2",
"ts-jest": "29.2.5",
"tsc-alias": "1.8.10",
"typescript": "5.5.4",
"typescript-eslint": "8.4.0",
"vanilla-framework": "4.15.0",
"wait-on": "7.2.0",
"wait-on": "8.0.0",
"webpack": "5.94.0"
},
"dependencies": {
"@types/jest": "29.5.12",
"@types/node": "20.12.11",
"@types/react": "18.3.1",
"@types/node": "20.16.3",
"@types/react": "18.3.5",
"@types/react-dom": "18.3.0",
"@types/react-table": "7.7.20",
"classnames": "2.5.1",
Expand All @@ -107,10 +111,11 @@
"react-useportal": "1.0.19"
},
"resolutions": {
"@types/react": "18.3.1",
"@types/react": "18.3.5",
"@types/react-dom": "18.3.0",
"postcss": "^8.3.11",
"jackspeak": "2.1.1"
"jackspeak": "2.1.1",
"strip-ansi": "6.0.1"
},
"peerDependencies": {
"@types/react": "^18.0.0",
Expand All @@ -127,7 +132,7 @@
"build-watch": "yarn run build-local --watch",
"build-docs": "storybook build -c .storybook -o docs",
"clean": "rm -rf node_modules dist .out",
"docs": "storybook dev -p ${PORT:-9009}",
"docs": "storybook dev -p ${PORT:-9009} --no-open",
"link-packages": "yarn install && yarn build && yarn link && cd node_modules/react && yarn link && cd ../react-dom && yarn link",
"lint-js": "eslint src",
"lint-style": "stylelint src/**/*.scss",
Expand All @@ -145,9 +150,6 @@
"semantic-release": "semantic-release",
"semantic-release-dry-run": "semantic-release --dry-run --no-ci"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
Expand Down
Loading

0 comments on commit 5ea22b2

Please sign in to comment.