@haltcase/style 7.0.0-canary.11 → 7.0.0-canary.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/types/eslint/configs/browser.d.ts +8 -0
  2. package/dist/types/eslint/configs/cjs.d.ts +4 -0
  3. package/dist/types/eslint/configs/internal/base.d.ts +52 -0
  4. package/dist/types/eslint/configs/internal/commonjs.d.ts +4 -0
  5. package/dist/types/eslint/configs/internal/es2015.d.ts +4 -0
  6. package/dist/types/eslint/configs/internal/simple-import-sort.d.ts +4 -0
  7. package/dist/types/eslint/configs/internal/tsdoc.d.ts +4 -0
  8. package/dist/types/eslint/configs/internal/unicorn.d.ts +4 -0
  9. package/dist/types/eslint/configs/next.d.ts +8 -0
  10. package/dist/types/eslint/configs/node.d.ts +8 -0
  11. package/dist/types/eslint/configs/playwright-test.d.ts +4 -0
  12. package/dist/types/eslint/configs/react.d.ts +8 -0
  13. package/dist/types/eslint/configs/typescript.d.ts +4 -0
  14. package/dist/types/eslint/constants.d.ts +14 -0
  15. package/dist/types/eslint/index.d.ts +12 -0
  16. package/dist/types/eslint/rules/best-practice.d.ts +5 -0
  17. package/dist/types/eslint/rules/imports.d.ts +5 -0
  18. package/dist/types/eslint/rules/jsx-a11y.d.ts +5 -0
  19. package/dist/types/eslint/rules/playwright-test.d.ts +8 -0
  20. package/dist/types/eslint/rules/possible-errors.d.ts +8 -0
  21. package/dist/types/eslint/rules/react-x.d.ts +8 -0
  22. package/dist/types/eslint/rules/react.d.ts +11 -0
  23. package/dist/types/eslint/rules/stylistic-jsx.d.ts +8 -0
  24. package/dist/types/eslint/rules/stylistic.d.ts +8 -0
  25. package/dist/types/eslint/rules/typescript/extension.d.ts +5 -0
  26. package/dist/types/eslint/rules/typescript/import.d.ts +5 -0
  27. package/dist/types/eslint/rules/typescript/index.d.ts +8 -0
  28. package/dist/types/eslint/rules/typescript/naming-convention.d.ts +5 -0
  29. package/dist/types/eslint/rules/variables.d.ts +8 -0
  30. package/dist/types/eslint/withFiles.d.ts +2 -0
  31. package/dist/types/prettier/index.d.ts +12 -0
  32. package/dist/types/stylelint/_base.d.ts +1 -0
  33. package/dist/types/stylelint/index.d.ts +2 -0
  34. package/dist/types/stylelint/modules.d.ts +2 -0
  35. package/dist/types/stylelint/standard.d.ts +1 -0
  36. package/package.json +31 -8
  37. package/prettier/index.js +16 -4
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
3
+ */
4
+ export const getEslintBrowserConfig: import("./internal/base.js").HaltcaseStyleCreator;
5
+ /**
6
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
7
+ */
8
+ export const getEslintBrowserConfigInternal: import("./internal/base.js").HaltcaseStyleCreator;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
3
+ */
4
+ export const getEslintCommonJsConfig: import("./internal/base.js").HaltcaseStyleCreator;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @typedef {Object} HaltcaseStyleOptions
3
+ * @property {boolean} [browser] Whether to include browser rules and globals.
4
+ * @property {boolean} [commonjs] Whether to treat *.js files as CommonJS instead of ES Modules.
5
+ * @property {boolean} [nextjs] Whether to include Next.js rules (implies `react`).
6
+ * @property {boolean} [node] Whether to include Node.js rules.
7
+ * @property {boolean} [react] Whether to include React rules.
8
+ * @property {ParserOptions["project"]} [typescriptProject = true] Custom TypeScript project options for the `typescript-eslint` parser.
9
+ * // use when VS Code supports `projectService`
10
+ * // https://github.com/microsoft/vscode-eslint/issues/1911
11
+ * property {ProjectServiceOptions} [typescriptProjectServiceOptions = true] Custom TypeScript project service options for the `typescript-eslint` parser.
12
+ */
13
+ /**
14
+ * @typedef {(options?: HaltcaseStyleOptions) => Awaited<import("typescript-eslint").Config>} HaltcaseStyleCreator
15
+ */
16
+ /**
17
+ * Get the common ESLint config for Node and browsers.
18
+ *
19
+ * @type {HaltcaseStyleCreator}
20
+ */
21
+ export const getEslintBaseConfig: HaltcaseStyleCreator;
22
+ export type HaltcaseStyleOptions = {
23
+ /**
24
+ * Whether to include browser rules and globals.
25
+ */
26
+ browser?: boolean | undefined;
27
+ /**
28
+ * Whether to treat *.js files as CommonJS instead of ES Modules.
29
+ */
30
+ commonjs?: boolean | undefined;
31
+ /**
32
+ * Whether to include Next.js rules (implies `react`).
33
+ */
34
+ nextjs?: boolean | undefined;
35
+ /**
36
+ * Whether to include Node.js rules.
37
+ */
38
+ node?: boolean | undefined;
39
+ /**
40
+ * Whether to include React rules.
41
+ */
42
+ react?: boolean | undefined;
43
+ /**
44
+ * Custom TypeScript project options for the `typescript-eslint` parser.
45
+ * // use when VS Code supports `projectService`
46
+ * // https://github.com/microsoft/vscode-eslint/issues/1911
47
+ * property {ProjectServiceOptions} [typescriptProjectServiceOptions = true] Custom TypeScript project service options for the `typescript-eslint` parser.
48
+ */
49
+ typescriptProject?: ParserOptions["project"];
50
+ };
51
+ export type HaltcaseStyleCreator = (options?: HaltcaseStyleOptions) => Awaited<import("typescript-eslint").Config>;
52
+ import type { ParserOptions } from "@typescript-eslint/types";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {import("./base.js").HaltcaseStyleCreator}
3
+ */
4
+ export const getEslintCommonJsConfigInternal: import("./base.js").HaltcaseStyleCreator;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {ReturnType<import("./base.js").HaltcaseStyleCreator>}
3
+ */
4
+ export const eslintEs2015Config: ReturnType<import("./base.js").HaltcaseStyleCreator>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {ReturnType<import("./base.js").HaltcaseStyleCreator>}
3
+ */
4
+ export const eslintSimpleImportSortConfig: ReturnType<import("./base.js").HaltcaseStyleCreator>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {ReturnType<import("./base.js").HaltcaseStyleCreator>}
3
+ */
4
+ export const eslintTsdocConfig: ReturnType<import("./base.js").HaltcaseStyleCreator>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {ReturnType<import("./base.js").HaltcaseStyleCreator>}
3
+ */
4
+ export const eslintUnicornConfig: ReturnType<import("./base.js").HaltcaseStyleCreator>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
3
+ */
4
+ export const getEslintNextConfig: import("./internal/base.js").HaltcaseStyleCreator;
5
+ /**
6
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
7
+ */
8
+ export const getEslintNextConfigInternal: import("./internal/base.js").HaltcaseStyleCreator;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
3
+ */
4
+ export const getEslintNodeConfig: import("./internal/base.js").HaltcaseStyleCreator;
5
+ /**
6
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
7
+ */
8
+ export const getEslintNodeConfigInternal: import("./internal/base.js").HaltcaseStyleCreator;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
3
+ */
4
+ export const getEslintPlaywrightTestConfig: import("./internal/base.js").HaltcaseStyleCreator;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
3
+ */
4
+ export const getEslintReactConfig: import("./internal/base.js").HaltcaseStyleCreator;
5
+ /**
6
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
7
+ */
8
+ export const getEslintReactConfigInternal: import("./internal/base.js").HaltcaseStyleCreator;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {import("./internal/base.js").HaltcaseStyleCreator}
3
+ */
4
+ export const getEslintTypescriptConfig: import("./internal/base.js").HaltcaseStyleCreator;
@@ -0,0 +1,14 @@
1
+ export const ecmaVersion: 2021;
2
+ export const commonJsOnlyFiles: string[];
3
+ export const commonJsFiles: string[];
4
+ export const javascriptFiles: string[];
5
+ export const typescriptFiles: string[];
6
+ export const javascriptJsxFiles: string[];
7
+ export const typescriptJsxFiles: string[];
8
+ export const jsxFiles: string[];
9
+ export const configFiles: string[];
10
+ export const scriptFiles: string[];
11
+ export const nextJsPageFiles: string[];
12
+ export const nextJsApiRoutes: string[];
13
+ export const nextJsMetadataFiles: string[];
14
+ export const allSupportedFiles: string[];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @type {import("./configs/internal/base.js").HaltcaseStyleCreator}
3
+ */
4
+ export const getEslintConfig: import("./configs/internal/base.js").HaltcaseStyleCreator;
5
+ export default getEslintConfig;
6
+ export { getEslintBrowserConfig } from "./configs/browser.js";
7
+ export { getEslintCommonJsConfig } from "./configs/cjs.js";
8
+ export { getEslintNextConfig } from "./configs/next.js";
9
+ export { getEslintNodeConfig } from "./configs/node.js";
10
+ export { getEslintReactConfig } from "./configs/react.js";
11
+ export { getEslintTypescriptConfig } from "./configs/typescript.js";
12
+ export { withFiles } from "./withFiles.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @type {Linter.RulesRecord}
3
+ */
4
+ export const bestPracticeRules: Linter.RulesRecord;
5
+ import type { Linter } from "eslint";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @type {Linter.RulesRecord}
3
+ */
4
+ export const importRules: Linter.RulesRecord;
5
+ import type { Linter } from "eslint";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @type {Linter.RulesRecord}
3
+ */
4
+ export const jsxA11yRules: Linter.RulesRecord;
5
+ import type { Linter } from "eslint";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @import { Linter } from "eslint"
3
+ */
4
+ /**
5
+ * @type {Linter.RulesRecord}
6
+ */
7
+ export const playwrightTestRules: Linter.RulesRecord;
8
+ import type { Linter } from "eslint";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @import { Linter } from "eslint"
3
+ */
4
+ /**
5
+ * @type {Linter.RulesRecord}
6
+ */
7
+ export const possibleErrorsRules: Linter.RulesRecord;
8
+ import type { Linter } from "eslint";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Additional rules to enable on top of the preset config from
3
+ * `@eslint-react/eslint-plugin`
4
+ *
5
+ * @type {Linter.RulesRecord}
6
+ */
7
+ export const reactXRules: Linter.RulesRecord;
8
+ import type { Linter } from "eslint";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @import { Linter } from "eslint"
3
+ */
4
+ /**
5
+ * We primarily use `@eslint-react/eslint-plugin`, but it's not quite complete
6
+ * compared to the official plugin. We enable missing rules selectively here.
7
+ *
8
+ * @type {Linter.RulesRecord}
9
+ */
10
+ export const reactRules: Linter.RulesRecord;
11
+ import type { Linter } from "eslint";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @import { Linter } from "eslint"
3
+ */
4
+ /**
5
+ * @type {Linter.RulesRecord}
6
+ */
7
+ export const stylisticJsxRules: Linter.RulesRecord;
8
+ import type { Linter } from "eslint";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @import { Linter } from "eslint"
3
+ */
4
+ /**
5
+ * @type {Linter.RulesRecord}
6
+ */
7
+ export const stylisticRules: Linter.RulesRecord;
8
+ import type { Linter } from "eslint";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @type {Linter.RulesRecord}
3
+ */
4
+ export const typescriptExtensionRules: Linter.RulesRecord;
5
+ import type { Linter } from "eslint";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @type {Linter.RulesRecord}
3
+ */
4
+ export const typescriptImportRules: Linter.RulesRecord;
5
+ import type { Linter } from "eslint";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @import { Linter } from "eslint"
3
+ */
4
+ /**
5
+ * @type {Linter.RulesRecord}
6
+ */
7
+ export const typescriptBaseRules: Linter.RulesRecord;
8
+ import type { Linter } from "eslint";
@@ -0,0 +1,5 @@
1
+ export function getTypescriptNamingConventionRule({ isComponentLike, isTsx }?: {
2
+ isComponentLike?: boolean | undefined;
3
+ isTsx?: boolean | undefined;
4
+ }): Linter.RulesRecord;
5
+ import type { Linter } from "eslint";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @import { Linter } from "eslint"
3
+ */
4
+ /**
5
+ * @type {Linter.RulesRecord}
6
+ */
7
+ export const variablesRules: Linter.RulesRecord;
8
+ import type { Linter } from "eslint";
@@ -0,0 +1,2 @@
1
+ export function withFiles(configArray: Linter.Config[], files: string[]): Linter.Config[];
2
+ import type { Linter } from "eslint";
@@ -0,0 +1,12 @@
1
+ declare namespace _default {
2
+ let singleQuote: boolean;
3
+ let trailingComma: string;
4
+ let plugins: string[];
5
+ let tailwindAttributes: string[];
6
+ let tailwindFunctions: string[];
7
+ let endOfLine: "lf";
8
+ let printWidth: number;
9
+ let tabWidth: number;
10
+ let useTabs: true;
11
+ }
12
+ export default _default;
@@ -0,0 +1 @@
1
+ export const stylelintBase: import("stylelint-define-config").StylelintConfig;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("stylelint-define-config").StylelintConfig;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("stylelint-define-config").StylelintConfig;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export { stylelintBase as default } from "./_base.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haltcase/style",
3
- "version": "7.0.0-canary.11",
3
+ "version": "7.0.0-canary.13",
4
4
  "description": "haltcase's web ecosystem style guide & configurations",
5
5
  "keywords": [
6
6
  "eslint",
@@ -19,13 +19,34 @@
19
19
  "author": "Bo Lingen <bo@haltcase.dev> (https://haltcase.dev)",
20
20
  "type": "module",
21
21
  "exports": {
22
- "./eslint": "./eslint/index.js",
23
- "./eslint/rules/*": "./eslint/rules/*.js",
24
- "./eslint/rules/*.js": "./eslint/rules/*.js",
25
- "./prettier": "./prettier/index.js",
26
- "./stylelint": "./stylelint/index.js",
27
- "./stylelint/modules": "./stylelint/modules.js",
28
- "./stylelint/standard": "./stylelint/standard.js",
22
+ "./eslint": {
23
+ "types": "./dist/types/eslint/index.d.ts",
24
+ "default": "./eslint/index.js"
25
+ },
26
+ "./eslint/rules/*": {
27
+ "types": "./dist/types/eslint/rules/*.d.ts",
28
+ "default": "./eslint/rules/*.js"
29
+ },
30
+ "./eslint/rules/typescript": {
31
+ "types": "./dist/types/eslint/rules/typescript/index.d.ts",
32
+ "default": "./eslint/rules/typescript/index.js"
33
+ },
34
+ "./prettier": {
35
+ "types": "./dist/types/prettier/index.d.ts",
36
+ "default": "./prettier/index.js"
37
+ },
38
+ "./stylelint": {
39
+ "types": "./dist/types/stylelint/index.d.ts",
40
+ "default": "./stylelint/index.js"
41
+ },
42
+ "./stylelint/modules": {
43
+ "types": "./dist/types/stylelint/modules.d.ts",
44
+ "default": "./stylelint/modules.js"
45
+ },
46
+ "./stylelint/standard": {
47
+ "types": "./dist/types/stylelint/standard.d.ts",
48
+ "default": "./stylelint/standard.js"
49
+ },
29
50
  "./typescript/base": "./typescript/tsconfig.base.json",
30
51
  "./typescript/bundler": "./typescript/tsconfig.bundler.json",
31
52
  "./typescript/next": "./typescript/tsconfig.next.json",
@@ -36,6 +57,7 @@
36
57
  "./typescript/web": "./typescript/tsconfig.web.json"
37
58
  },
38
59
  "files": [
60
+ "dist",
39
61
  "eslint",
40
62
  "prettier",
41
63
  "stylelint",
@@ -46,6 +68,7 @@
46
68
  "eslint-check": "eslint --max-warnings=0 .",
47
69
  "format": "eslint --fix . && prettier --write .",
48
70
  "prepare": "husky",
71
+ "prepublishOnly": "tsc",
49
72
  "prettier-check": "prettier --check .",
50
73
  "semantic-release": "semantic-release",
51
74
  "test": "echo \"Error: no test specified\" && exit 1"
package/prettier/index.js CHANGED
@@ -1,12 +1,14 @@
1
1
  /* eslint-disable import-x/no-default-export */
2
2
 
3
+ import { fileURLToPath } from "node:url";
4
+
3
5
  /**
4
6
  * Some of Prettier's defaults can be overridden by an EditorConfig file. We
5
7
  * define those here to ensure that doesn't happen.
6
8
  *
7
9
  * See: https://prettier.io/docs/en/configuration#editorconfig
8
10
  *
9
- * @type {import("prettier").Options}
11
+ * @satisfies {import("prettier").Options}
10
12
  */
11
13
  const overridableDefaults = {
12
14
  endOfLine: "lf",
@@ -16,12 +18,22 @@ const overridableDefaults = {
16
18
  };
17
19
 
18
20
  /**
19
- * @type {import("prettier").Options}
21
+ * @param {string} specifier - The plugin's package name.
22
+ */
23
+ const resolvePlugin = (specifier) =>
24
+ fileURLToPath(import.meta.resolve(specifier));
25
+
26
+ /**
27
+ * @satisfies {import("prettier").Options}
20
28
  */
21
29
  export default {
22
30
  ...overridableDefaults,
23
31
  singleQuote: false,
24
32
  trailingComma: "none",
25
- plugins: ["prettier-plugin-packagejson", "prettier-plugin-tailwindcss"],
26
- tailwindAttributes: ["classNames", "clsx", "cx", "twMerge"]
33
+ plugins: [
34
+ resolvePlugin("prettier-plugin-packagejson"),
35
+ resolvePlugin("prettier-plugin-tailwindcss")
36
+ ],
37
+ tailwindAttributes: ["classNames"],
38
+ tailwindFunctions: ["clsx", "cn", "cx", "twMerge"]
27
39
  };