Skip to content

Commit

Permalink
Merge pull request #249 from AndreaPontrandolfo/AndreaPontrandolfo/is…
Browse files Browse the repository at this point in the history
…sue247

AndreaPontrandolfo/issue247
  • Loading branch information
AndreaPontrandolfo authored Aug 31, 2024
2 parents 46c03de + 19f7418 commit f2bab54
Show file tree
Hide file tree
Showing 23 changed files with 625 additions and 392 deletions.
18 changes: 18 additions & 0 deletions .changeset/sour-windows-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'eslint-config-sheriff': minor
'config-validation-playground': patch
'@sherifforg/create-config': patch
'sheriff-webservices': patch
'@sherifforg/types': patch
'@sheriff/utils': patch
'@sherifforg/cli': patch
'docs-website': patch
---

feat(rules): removed react/jsx-props-no-spreading
feat(rules): added no-useless-computed-key
feat(rules): added unicorn/no-unused-properties
feat(rules): restricted the confusingBrowserGlobals
feat(rule): added react/no-this-in-sfc
chore(deps): updated some deps
Closes #247
2 changes: 1 addition & 1 deletion apps/config-validation-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"devDependencies": {
"@storybook/react": "^7.6.20",
"@types/node": "^20.14.10",
"@types/node": "^22.5.1",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.2.15",
"eslint": "^9.9.0",
Expand Down
2 changes: 2 additions & 0 deletions apps/config-validation-playground/src/mocks/InfoButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from 'react';

interface InfoButtonProps {
text: string;
}
Expand Down
2 changes: 2 additions & 0 deletions apps/config-validation-playground/src/samples/react.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from 'react';

export const MyComponent = (): JSX.Element => {
return (
<div>
Expand Down
39 changes: 19 additions & 20 deletions apps/docs-website/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sheriff } from "eslint-config-sheriff";
import { defineFlatConfig } from "eslint-define-config";
import docusaurusEslintPlugin from "@docusaurus/eslint-plugin";
import { flat, flatCodeBlocks, createRemarkProcessor } from "eslint-plugin-mdx";
import { sheriff } from 'eslint-config-sheriff';
import { defineFlatConfig } from 'eslint-define-config';
import docusaurusEslintPlugin from '@docusaurus/eslint-plugin';
import { flat, flatCodeBlocks, createRemarkProcessor } from 'eslint-plugin-mdx';

const sheriffOptions = {
react: true,
Expand All @@ -16,15 +16,15 @@ const sheriffOptions = {
export default defineFlatConfig([
...sheriff(sheriffOptions),
{
files: ["*.tsx", "*.ts"], // .mdx?
files: ['*.tsx', '*.ts'], // .mdx?
plugins: {
"@docusaurus": docusaurusEslintPlugin,
'@docusaurus': docusaurusEslintPlugin,
},
rules: {
"@docusaurus/no-untranslated-text": 0, // enable when we have translations
"@docusaurus/string-literal-i18n-messages": 0, // enable when we have translations,
"@docusaurus/no-html-links": 2,
"@docusaurus/prefer-docusaurus-heading": 2,
'@docusaurus/no-untranslated-text': 0, // enable when we have translations
'@docusaurus/string-literal-i18n-messages': 0, // enable when we have translations,
'@docusaurus/no-html-links': 2,
'@docusaurus/prefer-docusaurus-heading': 2,
},
},
{
Expand All @@ -41,34 +41,33 @@ export default defineFlatConfig([
},
},
{
files: ["**/*ts", "**/*tsx"],
files: ['**/*ts', '**/*tsx'],
rules: {
"sonarjs/no-duplicate-string": 0,
"react/jsx-props-no-spreading": 0,
"@typescript-eslint/no-misused-promises": [
'sonarjs/no-duplicate-string': 0,
'@typescript-eslint/no-misused-promises': [
2,
{
checksVoidReturn: {
attributes: false,
},
},
],
"import/no-unresolved": [
'import/no-unresolved': [
2,
{
commonjs: true,
caseSensitiveStrict: true,
ignore: ["^@theme", "^@docusaurus"],
ignore: ['^@theme', '^@docusaurus'],
},
],
},
},
{
ignores: [
".docusaurus/**/*",
".turbo/**/*",
"babel.config.js",
"CHANGELOG.md",
'.docusaurus/**/*',
'.turbo/**/*',
'babel.config.js',
'CHANGELOG.md',
],
},
]);
2 changes: 1 addition & 1 deletion apps/docs-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@hookform/devtools": "^4.3.1",
"@sherifforg/types": "workspace:*",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.14.10",
"@types/node": "^22.5.1",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.2.15",
"eslint": "^9.9.0",
Expand Down
2 changes: 2 additions & 0 deletions apps/docs-website/src/components/ComparisonTable.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from 'react';

interface TableEntry {
FlatConfig: '✅' | '❌';
Maintained: '✅' | '❌';
Expand Down
29 changes: 15 additions & 14 deletions apps/docs-website/src/components/ConfigCombinationForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useForm } from "react-hook-form";
import { DevTool } from "@hookform/devtools";
import { configCombinationDefaultValues } from "@sherifforg/constants";
import styles from "./ConfigCombinationForm.module.css";
import type { JSX } from 'react';
import { useForm } from 'react-hook-form';
import { DevTool } from '@hookform/devtools';
import { configCombinationDefaultValues } from '@sherifforg/constants';
import styles from './ConfigCombinationForm.module.css';

interface ConfigCombinationFormProps {
setTableData: (data: FormInputs) => void;
Expand All @@ -24,18 +25,18 @@ export const ConfigCombinationForm = ({
});

const handleVitestChange = (isChecked: boolean) => {
setValue("vitest", isChecked, { shouldDirty: true, shouldTouch: true });
setValue('vitest', isChecked, { shouldDirty: true, shouldTouch: true });

if (isChecked) {
setValue("jest", false, { shouldDirty: true, shouldTouch: true });
setValue('jest', false, { shouldDirty: true, shouldTouch: true });
}
};

const handleJestChange = (isChecked: boolean) => {
setValue("jest", isChecked, { shouldDirty: true, shouldTouch: true });
setValue('jest', isChecked, { shouldDirty: true, shouldTouch: true });

if (isChecked) {
setValue("vitest", false, { shouldDirty: true, shouldTouch: true });
setValue('vitest', false, { shouldDirty: true, shouldTouch: true });
}
};

Expand All @@ -48,7 +49,7 @@ export const ConfigCombinationForm = ({
>
<div className={styles.nativeCheckbox}>
<input
{...register("react")}
{...register('react')}
defaultChecked
type="checkbox"
id="react"
Expand All @@ -57,20 +58,20 @@ export const ConfigCombinationForm = ({
</div>
<div className={styles.nativeCheckbox}>
<input
{...register("lodash")}
{...register('lodash')}
defaultChecked
type="checkbox"
id="lodash"
/>
<label htmlFor="lodash">Lodash</label>
</div>
<div className={styles.nativeCheckbox}>
<input {...register("next")} defaultChecked type="checkbox" id="next" />
<input {...register('next')} defaultChecked type="checkbox" id="next" />
<label htmlFor="next">Next</label>
</div>
<div className={styles.nativeCheckbox}>
<input
{...register("playwright")}
{...register('playwright')}
defaultChecked
type="checkbox"
id="playwright"
Expand All @@ -79,7 +80,7 @@ export const ConfigCombinationForm = ({
</div>
<div className={styles.nativeCheckbox}>
<input
{...register("vitest")}
{...register('vitest')}
defaultChecked
type="checkbox"
id="vitest"
Expand All @@ -92,7 +93,7 @@ export const ConfigCombinationForm = ({

<div className={styles.nativeCheckbox}>
<input
{...register("jest")}
{...register('jest')}
type="checkbox"
id="jest"
onChange={(e) => {
Expand Down
24 changes: 14 additions & 10 deletions apps/docs-website/src/components/DynamicSnippetsList.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import type React from "react";
import type { JSX } from 'react';

interface DynamicSnippetsListProps {
paths: string[];
}

export const DynamicSnippetsList = ({
paths,
}: DynamicSnippetsListProps): React.JSX.Element =>
{ return <ul>
{paths.map((path) =>
{ return <li key={path}>
<code>{path}</code>
</li> }
)}
</ul> }
;
}: DynamicSnippetsListProps): JSX.Element => {
return (
<ul>
{paths.map((path) => {
return (
<li key={path}>
<code>{path}</code>
</li>
);
})}
</ul>
);
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styles from "./QueriedRulesMetricsGroup.module.css";
import type { JSX } from 'react';
import styles from './QueriedRulesMetricsGroup.module.css';

interface QueriedRulesMetricsGroupProps {
totalAvailableRulesAmount: number;
Expand Down
Loading

0 comments on commit f2bab54

Please sign in to comment.