From 3cf8eb0e28898b172deb629cf932702d4db3c0ce Mon Sep 17 00:00:00 2001 From: AndreaPontrandolfo Date: Sun, 2 Jun 2024 22:34:45 +0200 Subject: [PATCH] refactor: reordered imports --- apps/docs-website/docusaurus.config.ts | 78 ++++++++--------- .../src/components/DynamicSnippetsList.tsx | 16 ++-- .../src/components/RulesTable.tsx | 86 +++++++++---------- apps/docs-website/src/pages/index.tsx | 4 +- .../src/utils/filterDuplicatedRules.ts | 2 +- .../src/generateRulesDataset.ts | 10 +-- apps/sheriff-webservices/src/getAllRules.ts | 40 ++++----- apps/sheriff-webservices/src/index.ts | 24 +++--- .../src/prependRulesWithPluginName.ts | 2 +- packages/create-sheriff-config/src/index.ts | 8 +- .../src/utils/autoInstallPackages.ts | 4 +- .../src/utils/createFile.ts | 2 +- .../src/utils/getEslintConfigRawText.ts | 2 +- .../src/utils/patchedFindUp.ts | 2 +- .../src/utils/setEslintConfig.ts | 4 +- .../src/utils/setPrettierConfig.ts | 2 +- .../src/utils/setPrettierIgnore.ts | 2 +- .../src/utils/setSheriffConfig.ts | 2 +- .../src/utils/throwError.ts | 2 +- .../src/getBaseConfig.ts | 2 +- .../handpickedRules/importHandPickedRules.ts | 4 +- packages/sheriff-constants/package.json | 2 - 22 files changed, 150 insertions(+), 150 deletions(-) diff --git a/apps/docs-website/docusaurus.config.ts b/apps/docs-website/docusaurus.config.ts index 72740fdd..e2807f74 100644 --- a/apps/docs-website/docusaurus.config.ts +++ b/apps/docs-website/docusaurus.config.ts @@ -1,8 +1,8 @@ +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; @@ -10,101 +10,101 @@ 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 // pathname under which your site is served // For GitHub pages deployment, it is often '//' - 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: `
v${version}
`, - 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, diff --git a/apps/docs-website/src/components/DynamicSnippetsList.tsx b/apps/docs-website/src/components/DynamicSnippetsList.tsx index c0ecab1d..34651667 100644 --- a/apps/docs-website/src/components/DynamicSnippetsList.tsx +++ b/apps/docs-website/src/components/DynamicSnippetsList.tsx @@ -6,12 +6,12 @@ interface DynamicSnippetsListProps { export const DynamicSnippetsList = ({ paths, -}: DynamicSnippetsListProps): React.JSX.Element => ( -
    - {paths.map((path) => ( -
  • +}: DynamicSnippetsListProps): React.JSX.Element => + { return
      + {paths.map((path) => + { return
    • {path} -
    • - ))} -
    -); +
  • } + )} +
} +; diff --git a/apps/docs-website/src/components/RulesTable.tsx b/apps/docs-website/src/components/RulesTable.tsx index 033e80cb..3922e0e7 100644 --- a/apps/docs-website/src/components/RulesTable.tsx +++ b/apps/docs-website/src/components/RulesTable.tsx @@ -1,5 +1,10 @@ /* 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, @@ -7,16 +12,11 @@ import { 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; @@ -45,11 +45,11 @@ const columns = [ }), columnHelper.accessor("docs", { header: "Docs", - cell: (info) => ( - + cell: (info) => + { return {info.getValue().description || info.getValue().url} - - ), + } + , }), columnHelper.accessor("affectedFiles", { header: "Files", @@ -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)", @@ -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(); @@ -233,10 +233,10 @@ export const RulesTable = (): JSX.Element => { ) : ( - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => ( - + {headerGroup.headers.map((header) => + { return - ))} - - ))} + } + )} + } + )} - {table.getRowModel().rows.map((row) => ( - - {row.getVisibleCells().map((cell) => ( - + {row.getVisibleCells().map((cell) => + { return - ))} - - ))} + } + )} + } + )}
+ { return
{ header.column.columnDef.header, header.getContext(), )} -
+ { return
{ }} > {flexRender(cell.column.columnDef.cell, cell.getContext())} -
)} diff --git a/apps/docs-website/src/pages/index.tsx b/apps/docs-website/src/pages/index.tsx index 773e0b80..785d5006 100644 --- a/apps/docs-website/src/pages/index.tsx +++ b/apps/docs-website/src/pages/index.tsx @@ -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"; diff --git a/apps/docs-website/src/utils/filterDuplicatedRules.ts b/apps/docs-website/src/utils/filterDuplicatedRules.ts index 13803897..dfba0256 100644 --- a/apps/docs-website/src/utils/filterDuplicatedRules.ts +++ b/apps/docs-website/src/utils/filterDuplicatedRules.ts @@ -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) => { diff --git a/apps/sheriff-webservices/src/generateRulesDataset.ts b/apps/sheriff-webservices/src/generateRulesDataset.ts index 3f6d4db4..1a878da8 100644 --- a/apps/sheriff-webservices/src/generateRulesDataset.ts +++ b/apps/sheriff-webservices/src/generateRulesDataset.ts @@ -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; diff --git a/apps/sheriff-webservices/src/getAllRules.ts b/apps/sheriff-webservices/src/getAllRules.ts index 55a9e0e2..e55ca667 100644 --- a/apps/sheriff-webservices/src/getAllRules.ts +++ b/apps/sheriff-webservices/src/getAllRules.ts @@ -1,36 +1,36 @@ /* eslint-disable import/newline-after-import */ -import eslintRecommended from "@eslint/js"; -import tseslint from "typescript-eslint"; -import unicorn from "eslint-plugin-unicorn"; -import sonarjs from "eslint-plugin-sonarjs"; -import playwright from "eslint-plugin-playwright"; -import jsdoc from "eslint-plugin-jsdoc"; // eslint-disable-line -import lodashPlugin from "eslint-plugin-lodash-f"; -import pluginImport from "eslint-plugin-import"; -import simpleImportSort from "eslint-plugin-simple-import-sort"; -import nextjs from "@next/eslint-plugin-next"; -import fp from "eslint-plugin-fp"; -import jest from "eslint-plugin-jest"; -import vitest from "eslint-plugin-vitest"; -import preferEarlyReturn from "@regru/eslint-plugin-prefer-early-return"; -import tsdoc from "eslint-plugin-tsdoc"; -import storybook from "eslint-plugin-storybook"; -import fsecond from "eslint-plugin-fsecond"; import arrowReturnStyle from "eslint-plugin-arrow-return-style"; -import stylistic from "@stylistic/eslint-plugin"; import astro from "eslint-plugin-astro"; -import reactRecommended from "eslint-plugin-react/configs/recommended.js"; -import jsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js"; +import fp from "eslint-plugin-fp"; +import fsecond from "eslint-plugin-fsecond"; +import pluginImport from "eslint-plugin-import"; +import jest from "eslint-plugin-jest"; +import jsdoc from "eslint-plugin-jsdoc"; // eslint-disable-line import reactAccessibility from "eslint-plugin-jsx-a11y"; +import lodashPlugin from "eslint-plugin-lodash-f"; +import playwright from "eslint-plugin-playwright"; +import jsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js"; +import reactRecommended from "eslint-plugin-react/configs/recommended.js"; import reactHooks from "eslint-plugin-react-hooks"; import reactRefresh from "eslint-plugin-react-refresh"; +import simpleImportSort from "eslint-plugin-simple-import-sort"; +import sonarjs from "eslint-plugin-sonarjs"; +import storybook from "eslint-plugin-storybook"; +import tsdoc from "eslint-plugin-tsdoc"; +import unicorn from "eslint-plugin-unicorn"; +import vitest from "eslint-plugin-vitest"; +import tseslint from "typescript-eslint"; +import eslintRecommended from "@eslint/js"; import rel1cxReact from "@eslint-react/eslint-plugin"; +import nextjs from "@next/eslint-plugin-next"; +import preferEarlyReturn from "@regru/eslint-plugin-prefer-early-return"; import type { BarebonesConfigAtom, RuleOptions, SheriffSettings, } from "@sherifforg/types"; +import stylistic from "@stylistic/eslint-plugin"; import { prependRulesWithPluginName } from "./prependRulesWithPluginName.js"; interface Plugin { diff --git a/apps/sheriff-webservices/src/index.ts b/apps/sheriff-webservices/src/index.ts index 48bea64e..10d28cf7 100644 --- a/apps/sheriff-webservices/src/index.ts +++ b/apps/sheriff-webservices/src/index.ts @@ -1,18 +1,18 @@ -import getSheriffConfig from "eslint-config-sheriff"; -import { Hono } from "hono"; -import { serve } from "@hono/node-server"; -import { cors } from "hono/cors"; -import type { BarebonesConfigAtom, SheriffSettings } from "@sherifforg/types"; -import { generateRulesDataset } from "./generateRulesDataset.js"; -import { getAllRules } from "./getAllRules.js"; +import getSheriffConfig from 'eslint-config-sheriff'; +import { Hono } from 'hono'; +import { cors } from 'hono/cors'; +import { serve } from '@hono/node-server'; +import type { BarebonesConfigAtom, SheriffSettings } from '@sherifforg/types'; +import { generateRulesDataset } from './generateRulesDataset.js'; +import { getAllRules } from './getAllRules.js'; const app = new Hono(); const port = Number(process.env.PORT || 5001); -app.use("/api/*", cors()); +app.use('/api/*', cors()); -app.get("/api/keepalive", (context) => context.text("OK")); -app.post("/api/get-new-sheriff-config", async (context) => { +app.get('/api/keepalive', (context) => context.text('OK')); +app.post('/api/get-new-sheriff-config', async (context) => { const userConfigChoices: SheriffSettings = await context.req.json(); const allRulesRaw = getAllRules(userConfigChoices); @@ -30,7 +30,7 @@ app.post("/api/get-new-sheriff-config", async (context) => { true, ); - console.info("Sending new config..."); + console.info('Sending new config...'); const allRulesCompiledConfig = generateRulesDataset( anyRuleAllowedConfig, allRulesRaw, @@ -40,7 +40,7 @@ app.post("/api/get-new-sheriff-config", async (context) => { allRulesRaw, ); - console.info("New config sent."); + console.info('New config sent.'); return context.json({ compiledConfig, diff --git a/apps/sheriff-webservices/src/prependRulesWithPluginName.ts b/apps/sheriff-webservices/src/prependRulesWithPluginName.ts index a6e7dafe..fb22b7e9 100644 --- a/apps/sheriff-webservices/src/prependRulesWithPluginName.ts +++ b/apps/sheriff-webservices/src/prependRulesWithPluginName.ts @@ -1,5 +1,5 @@ -import type { RuleOptions } from "@sherifforg/types"; import type { ESLint } from "eslint"; +import type { RuleOptions } from "@sherifforg/types"; export const prependRulesWithPluginName = ( rules: Record | ESLint.Plugin["rules"] | undefined, diff --git a/packages/create-sheriff-config/src/index.ts b/packages/create-sheriff-config/src/index.ts index 41def9da..926760a0 100644 --- a/packages/create-sheriff-config/src/index.ts +++ b/packages/create-sheriff-config/src/index.ts @@ -1,15 +1,15 @@ #!/usr/bin/env node +import { consola } from 'consola'; import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; -import { consola } from 'consola'; +import { askForCustomPath } from './utils/askForCustomPath'; +import { askForEslintTsPatch } from './utils/askForEslintTsPatch'; +import { askForPrettierSupport } from './utils/askForPrettierSupport'; import { setDependencies } from './utils/setDependencies'; import { setEslintConfig } from './utils/setEslintConfig'; import { setPrettierConfig } from './utils/setPrettierConfig'; import { setPrettierIgnore } from './utils/setPrettierIgnore'; -import { askForCustomPath } from './utils/askForCustomPath'; -import { askForPrettierSupport } from './utils/askForPrettierSupport'; -import { askForEslintTsPatch } from './utils/askForEslintTsPatch'; const { argv } = yargs(hideBin(process.argv)).option('filter', { type: 'string', diff --git a/packages/create-sheriff-config/src/utils/autoInstallPackages.ts b/packages/create-sheriff-config/src/utils/autoInstallPackages.ts index 160345f0..5c7e4c7f 100644 --- a/packages/create-sheriff-config/src/utils/autoInstallPackages.ts +++ b/packages/create-sheriff-config/src/utils/autoInstallPackages.ts @@ -1,9 +1,9 @@ -import { detectPackageManager, addDependency } from 'nypm'; import { consola } from 'consola'; import { colors } from 'consola/utils'; +import { addDependency,detectPackageManager } from 'nypm'; import { getInstallationCommand } from './getInstallationCommand'; -import { throwError } from './throwError'; import { getPackageJsonContents } from './getPackageJsonContents'; +import { throwError } from './throwError'; export const autoInstallPackages = async ( packages: string[], diff --git a/packages/create-sheriff-config/src/utils/createFile.ts b/packages/create-sheriff-config/src/utils/createFile.ts index c1044c99..5227c74f 100644 --- a/packages/create-sheriff-config/src/utils/createFile.ts +++ b/packages/create-sheriff-config/src/utils/createFile.ts @@ -1,6 +1,6 @@ -import { writeFile } from 'fs'; import { consola } from 'consola'; import { colors } from 'consola/utils'; +import { writeFile } from 'fs'; import { throwError } from './throwError'; export const createFile = ( diff --git a/packages/create-sheriff-config/src/utils/getEslintConfigRawText.ts b/packages/create-sheriff-config/src/utils/getEslintConfigRawText.ts index ce796c1e..7251250f 100644 --- a/packages/create-sheriff-config/src/utils/getEslintConfigRawText.ts +++ b/packages/create-sheriff-config/src/utils/getEslintConfigRawText.ts @@ -1,6 +1,6 @@ import { sheriffStartingOptions } from '@sherifforg/constants'; -import { throwError } from './throwError'; import { setSheriffConfig } from './setSheriffConfig'; +import { throwError } from './throwError'; export const getEslintConfigRawText = async ( fileType: 'ts' | 'esm' | 'commonjs', diff --git a/packages/create-sheriff-config/src/utils/patchedFindUp.ts b/packages/create-sheriff-config/src/utils/patchedFindUp.ts index ecea631f..0e523bb6 100644 --- a/packages/create-sheriff-config/src/utils/patchedFindUp.ts +++ b/packages/create-sheriff-config/src/utils/patchedFindUp.ts @@ -1,5 +1,5 @@ -import { resolve, dirname } from 'pathe'; import { findUp } from 'find-up'; +import { dirname,resolve } from 'pathe'; /** * Finds the first occurrence of a file in the directory hierarchy starting from the current working directory. diff --git a/packages/create-sheriff-config/src/utils/setEslintConfig.ts b/packages/create-sheriff-config/src/utils/setEslintConfig.ts index f2ae83fd..835125e3 100644 --- a/packages/create-sheriff-config/src/utils/setEslintConfig.ts +++ b/packages/create-sheriff-config/src/utils/setEslintConfig.ts @@ -1,10 +1,10 @@ import { consola } from 'consola'; import { colors } from 'consola/utils'; import { createFile } from './createFile'; +import { getEslintConfigRawText } from './getEslintConfigRawText'; import { getPackageJsonContents } from './getPackageJsonContents'; -import { throwError } from './throwError'; import { patchedFindUp } from './patchedFindUp'; -import { getEslintConfigRawText } from './getEslintConfigRawText'; +import { throwError } from './throwError'; export const setEslintConfig = async ( isEslintTsPatchRequired: boolean, diff --git a/packages/create-sheriff-config/src/utils/setPrettierConfig.ts b/packages/create-sheriff-config/src/utils/setPrettierConfig.ts index cb78bc4d..da828955 100644 --- a/packages/create-sheriff-config/src/utils/setPrettierConfig.ts +++ b/packages/create-sheriff-config/src/utils/setPrettierConfig.ts @@ -3,8 +3,8 @@ import { consola } from 'consola'; import { colors } from 'consola/utils'; import { createFile } from './createFile'; import { getPackageJsonContents } from './getPackageJsonContents'; -import { throwError } from './throwError'; import { patchedFindUp } from './patchedFindUp'; +import { throwError } from './throwError'; const prettierConfigRawText = `{}`; diff --git a/packages/create-sheriff-config/src/utils/setPrettierIgnore.ts b/packages/create-sheriff-config/src/utils/setPrettierIgnore.ts index 9f3812e3..a8de9cdf 100644 --- a/packages/create-sheriff-config/src/utils/setPrettierIgnore.ts +++ b/packages/create-sheriff-config/src/utils/setPrettierIgnore.ts @@ -1,8 +1,8 @@ import { consola } from 'consola'; import { colors } from 'consola/utils'; import { createFile } from './createFile'; -import { throwError } from './throwError'; import { patchedFindUp } from './patchedFindUp'; +import { throwError } from './throwError'; const prettierIgnoreRawText = `/node_modules/ /dist/ diff --git a/packages/create-sheriff-config/src/utils/setSheriffConfig.ts b/packages/create-sheriff-config/src/utils/setSheriffConfig.ts index 1ecefc49..be4e9405 100644 --- a/packages/create-sheriff-config/src/utils/setSheriffConfig.ts +++ b/packages/create-sheriff-config/src/utils/setSheriffConfig.ts @@ -1,5 +1,5 @@ -import { consola } from 'consola'; import { highlight } from 'cli-highlight'; +import { consola } from 'consola'; import { sheriffStartingOptions } from '@sherifforg/constants'; import { getPackageJsonContents } from './getPackageJsonContents'; import { throwError } from './throwError'; diff --git a/packages/create-sheriff-config/src/utils/throwError.ts b/packages/create-sheriff-config/src/utils/throwError.ts index 98d96d0e..c17282c7 100644 --- a/packages/create-sheriff-config/src/utils/throwError.ts +++ b/packages/create-sheriff-config/src/utils/throwError.ts @@ -1,5 +1,5 @@ -import { isString } from 'lodash-es'; import { consola } from 'consola'; +import { isString } from 'lodash-es'; interface Error { error?: unknown; diff --git a/packages/eslint-config-sheriff/src/getBaseConfig.ts b/packages/eslint-config-sheriff/src/getBaseConfig.ts index 92ba5706..22c8b331 100644 --- a/packages/eslint-config-sheriff/src/getBaseConfig.ts +++ b/packages/eslint-config-sheriff/src/getBaseConfig.ts @@ -122,7 +122,7 @@ export const getBaseConfig = (userConfigChoices: SheriffSettings) => { rules: { 'simple-import-sort/imports': [ 2, - { groups: [['^\\u0000', '^node:', '^@?\\w', '^', '^\\.']] }, + { groups: [['^\\u0000', '^node:', '^', '^@', '^@/', '^\\.']] }, ], 'simple-import-sort/exports': 2, }, diff --git a/packages/eslint-config-sheriff/src/handpickedRules/importHandPickedRules.ts b/packages/eslint-config-sheriff/src/handpickedRules/importHandPickedRules.ts index b0d8b629..739c4e2f 100644 --- a/packages/eslint-config-sheriff/src/handpickedRules/importHandPickedRules.ts +++ b/packages/eslint-config-sheriff/src/handpickedRules/importHandPickedRules.ts @@ -9,7 +9,9 @@ export const importHandPickedRules = { 'import/no-anonymous-default-export': 2, 'import/no-named-as-default': 2, 'import/no-duplicates': [2, { 'prefer-inline': true }], - 'import/newline-after-import': [2, { considerComments: true }], + // https://github.com/import-js/eslint-plugin-import/issues/2913 + // https://github.com/import-js/eslint-plugin-import/issues/2673 + 'import/newline-after-import': 2, 'import/no-useless-path-segments': [2, { noUselessIndex: true }], // 'import/consistent-type-specifier-style': [2, 'prefer-inline'], // this is not actually needed when "@typescript-eslint/no-import-type-side-effects is set. Explanation here: https://github.com/import-js/eslint-plugin-import/issues/2676#issuecomment-1407107260 }; diff --git a/packages/sheriff-constants/package.json b/packages/sheriff-constants/package.json index 058991f6..d7604449 100644 --- a/packages/sheriff-constants/package.json +++ b/packages/sheriff-constants/package.json @@ -6,9 +6,7 @@ "type": "module", "main": "./dist/index.js", "types": "./dist/index.d.ts", - "module": "./src/index.ts", "exports": { - "./package.json": "./package.json", ".": { "types": "./dist/index.d.ts", "require": "./dist/index.cjs",