Skip to content

Commit

Permalink
refactor: reordered imports
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaPontrandolfo committed Jun 2, 2024
1 parent 4b2c1d0 commit 3cf8eb0
Show file tree
Hide file tree
Showing 22 changed files with 150 additions and 150 deletions.
78 changes: 39 additions & 39 deletions apps/docs-website/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,110 +1,110 @@
import { version } from 'eslint-config-sheriff/package.json';
import { themes } from 'prism-react-renderer';
// eslint-disable-next-line @typescript-eslint/naming-convention
import type * as Preset from "@docusaurus/preset-classic";
import type { Config } from "@docusaurus/types";
import { themes } from "prism-react-renderer";
import { version } from "eslint-config-sheriff/package.json";
import type * as Preset from '@docusaurus/preset-classic';
import type { Config } from '@docusaurus/types';

const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

const currentYear = new Date().getFullYear();

const config: Config = {
title: "Sheriff",
title: 'Sheriff',
tagline:
"A comprehensive and opinionated Typescript-first ESLint configuration.",
favicon: "img/sheriff-logo.svg",
'A comprehensive and opinionated Typescript-first ESLint configuration.',
favicon: 'img/sheriff-logo.svg',

// Set the production url of your site here
url: "https://www.eslint-config-sheriff.dev",
url: 'https://www.eslint-config-sheriff.dev',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",
baseUrl: '/',

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "AndreaPontrandolfo", // Usually your GitHub org/user name.
projectName: "sheriff", // Usually your repo name.
organizationName: 'AndreaPontrandolfo', // Usually your GitHub org/user name.
projectName: 'sheriff', // Usually your repo name.

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',

// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
defaultLocale: 'en',
locales: ['en'],
},

presets: [
[
"classic",
'classic',
{
docs: {
sidebarPath: require.resolve("./sidebars.js"),
sidebarPath: require.resolve('./sidebars.js'),
remarkPlugins: [
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
[require('@docusaurus/remark-plugin-npm2yarn'), { sync: true }],
],
},
blog: {
showReadingTime: true,
remarkPlugins: [
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
[require('@docusaurus/remark-plugin-npm2yarn'), { sync: true }],
],
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
customCss: require.resolve('./src/css/custom.css'),
},
} satisfies Preset.Options,
],
],
themeConfig: {
image: "img/sheriff-social-card.jpg",
image: 'img/sheriff-social-card.jpg',
colorMode: {
respectPrefersColorScheme: true,
},
navbar: {
title: "Sheriff",
title: 'Sheriff',
logo: {
alt: "Sheriff Logo",
src: "img/sheriff-logo.svg",
alt: 'Sheriff Logo',
src: 'img/sheriff-logo.svg',
},
items: [
{
type: "docSidebar",
sidebarId: "mainSidebar",
position: "left",
label: "Docs",
type: 'docSidebar',
sidebarId: 'mainSidebar',
position: 'left',
label: 'Docs',
},
{ to: "/blog", label: "Blog", position: "left" },
{ to: '/blog', label: 'Blog', position: 'left' },
{
position: "right",
position: 'right',
value: `<div style="font-weight: 500;">v${version}</div>`,
type: "html",
type: 'html',
},
{
href: "https://github.com/AndreaPontrandolfo/sheriff",
position: "right",
className: "navbar-github-link",
href: 'https://github.com/AndreaPontrandolfo/sheriff',
position: 'right',
className: 'navbar-github-link',
},
],
},
footer: {
style: "dark",
style: 'dark',
copyright: `Copyright © ${currentYear.toString()} Sheriff. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ["bash", "diff", "json"],
additionalLanguages: ['bash', 'diff', 'json'],
},
algolia: {
appId: "E76LHB1EJI",
appId: 'E76LHB1EJI',
// Public API key: it is safe to commit it
apiKey: "8eaed87517914cb02078ae2ad16ee24a",
apiKey: '8eaed87517914cb02078ae2ad16ee24a',

indexName: "eslint-config-sheriff",
indexName: 'eslint-config-sheriff',

// Optional: see doc section below
contextualSearch: true,
Expand Down
16 changes: 8 additions & 8 deletions apps/docs-website/src/components/DynamicSnippetsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ interface DynamicSnippetsListProps {

export const DynamicSnippetsList = ({
paths,
}: DynamicSnippetsListProps): React.JSX.Element => (
<ul>
{paths.map((path) => (
<li key={path}>
}: DynamicSnippetsListProps): React.JSX.Element =>
{ return <ul>
{paths.map((path) =>
{ return <li key={path}>
<code>{path}</code>
</li>
))}
</ul>
);
</li> }
)}
</ul> }
;
86 changes: 43 additions & 43 deletions apps/docs-website/src/components/RulesTable.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
import { isEmpty } from "lodash-es";
import { useEffect, useRef, useState } from "react";
import { DebounceInput } from "react-debounce-input";
import Select from "react-select";
import { configCombinationDefaultValues } from "@sherifforg/constants";
import type { Entry, ServerResponse, SheriffSettings } from "@sherifforg/types";
import {
createColumnHelper,
flexRender,
getCoreRowModel,
getFilteredRowModel,
useReactTable,
} from "@tanstack/react-table";
import type { Entry, ServerResponse, SheriffSettings } from "@sherifforg/types";
import { isEmpty } from "lodash-es";
import Select from "react-select";
import { DebounceInput } from "react-debounce-input";
import { configCombinationDefaultValues } from "@sherifforg/constants";
import { filterDuplicateRules } from "../utils/filterDuplicatedRules";
import styles from "./RulesTable.module.css";
import { ConfigCombinationForm } from "./ConfigCombinationForm";
import { TableSkeleton } from "./TableSkeleton";
import { QueriedRulesMetricsGroup } from "./QueriedRulesMetricsGroup";
import styles from "./RulesTable.module.css";
import { TableSkeleton } from "./TableSkeleton";

interface FilterOption {
value: string;
Expand Down Expand Up @@ -45,11 +45,11 @@ const columns = [
}),
columnHelper.accessor("docs", {
header: "Docs",
cell: (info) => (
<a href={info.getValue().url} target="_blank" rel="noreferrer">
cell: (info) =>
{ return <a href={info.getValue().url} target="_blank" rel="noreferrer">
{info.getValue().description || info.getValue().url}
</a>
),
</a> }
,
}),
columnHelper.accessor("affectedFiles", {
header: "Files",
Expand Down Expand Up @@ -161,22 +161,22 @@ export const RulesTable = (): JSX.Element => {
placeholder="Filter by plugins..."
value={selectValue}
styles={{
control: (baseStyles) => ({
control: (baseStyles) => { return {
...baseStyles,
minWidth: "300px",
backgroundColor:
"var(--ifm-color-secondary-contrast-background)",
}),
input: (baseStyles) => ({
} },
input: (baseStyles) => { return {
...baseStyles,
color: "var(--ifm-font-color-primary)",
}),
menu: (baseStyles) => ({
} },
menu: (baseStyles) => { return {
...baseStyles,
backgroundColor:
"var(--ifm-color-secondary-contrast-background)",
}),
option: (baseStyles, state) => ({
} },
option: (baseStyles, state) => { return {
...baseStyles,
transition:
"color var(--ifm-transition-fast) var(--ifm-transition-timing-default)",
Expand All @@ -189,32 +189,32 @@ export const RulesTable = (): JSX.Element => {
":active": {
backgroundColor: "var(--ifm-menu-color-background-hover)",
},
}),
singleValue: (baseStyles) => ({
} },
singleValue: (baseStyles) => { return {
...baseStyles,
color: "var(--ifm-font-color-primary)",
}),
clearIndicator: (baseStyles) => ({
} },
clearIndicator: (baseStyles) => { return {
...baseStyles,
color: "var(--ifm-font-color-secondary)",
":hover": {
color: "var(--ifm-font-color-primary)",
},
cursor: "pointer",
}),
dropdownIndicator: (baseStyles) => ({
} },
dropdownIndicator: (baseStyles) => { return {
...baseStyles,
color: "var(--ifm-font-color-secondary)",
":hover": {
color: "var(--ifm-font-color-primary)",
},
cursor: "pointer",
}),
} },
}}
options={pluginsNames.map((pluginName) => ({
options={pluginsNames.map((pluginName) => { return {
value: pluginName,
label: pluginName,
}))}
} })}
onChange={(selectedOption) => {
setSelectValue(selectedOption);
resetInputValue();
Expand All @@ -233,10 +233,10 @@ export const RulesTable = (): JSX.Element => {
) : (
<table>
<thead>
{table.getHeaderGroups().map((headerGroup) => (
<tr key={headerGroup.id}>
{headerGroup.headers.map((header) => (
<th
{table.getHeaderGroups().map((headerGroup) =>
{ return <tr key={headerGroup.id}>
{headerGroup.headers.map((header) =>
{ return <th
key={header.id}
className={styles.th}
style={{
Expand All @@ -249,27 +249,27 @@ export const RulesTable = (): JSX.Element => {
header.column.columnDef.header,
header.getContext(),
)}
</th>
))}
</tr>
))}
</th> }
)}
</tr> }
)}
</thead>
<tbody>
{table.getRowModel().rows.map((row) => (
<tr key={row.id} className={styles.tr}>
{row.getVisibleCells().map((cell) => (
<td
{table.getRowModel().rows.map((row) =>
{ return <tr key={row.id} className={styles.tr}>
{row.getVisibleCells().map((cell) =>
{ return <td
key={cell.id}
className={styles.td}
style={{
maxWidth: cellMaxWidth,
}}
>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</td>
))}
</tr>
))}
</td> }
)}
</tr> }
)}
</tbody>
</table>
)}
Expand Down
4 changes: 2 additions & 2 deletions apps/docs-website/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import Layout from "@theme/Layout";
import { clsx } from "clsx";
import Link from "@docusaurus/Link";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import CodeBlock from "@theme/CodeBlock";
import Layout from "@theme/Layout";
import SheriffLogo from "../../static/img/sheriff-logo.svg";
import styles from "./index.module.css";

Expand Down
2 changes: 1 addition & 1 deletion apps/docs-website/src/utils/filterDuplicatedRules.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Entry } from "@sherifforg/types";
import { isEqual } from "lodash-es";
import type { Entry } from "@sherifforg/types";
import { removeElementFromArrayByValue } from "./removeElementFromArrayByValue";

const isSameItem = (firstOccurrence: Entry, secondOccurrence: Entry) => {
Expand Down
10 changes: 5 additions & 5 deletions apps/sheriff-webservices/src/generateRulesDataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable lodash-f/import-scope */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import lodash from "lodash";
import { Linter } from "eslint";
import lodash from "lodash";
import type {
Severity,
Plugins,
NumericSeverity,
Entry,
BarebonesConfigAtom,
Entry,
NumericSeverity,
Plugins,
RuleOptions,
RuleOptionsConfig,
ServerResponse,
Severity,
} from "@sherifforg/types";

const { isArray, isEmpty, last, uniq } = lodash;
Expand Down
Loading

0 comments on commit 3cf8eb0

Please sign in to comment.