@chanom/dev-config 0.0.1 → 0.0.2

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.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # @chanom/dev-config
2
+
3
+ Shared [oxlint](https://oxc.rs/docs/guide/usage/linter) and [oxfmt](https://oxc.rs/docs/guide/usage/formatter) config.
4
+
5
+ Two layers per tool:
6
+
7
+ - **base** - TypeScript-only rules, framework-agnostic. Use for libraries and Node packages.
8
+ - **config** - base plus React + jsx-a11y rules. Use for React apps.
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ pnpm add -D @chanom/dev-config oxlint oxfmt
14
+ ```
15
+
16
+ `oxlint` and `oxfmt` are peer dependencies, so install them in the consuming project too.
17
+
18
+ ## Exports
19
+
20
+ | Specifier | Contents |
21
+ | ---------------------------------- | ----------------------- |
22
+ | `@chanom/dev-config/oxlint/base` | TypeScript lint rules |
23
+ | `@chanom/dev-config/oxlint/config` | base + React + jsx-a11y |
24
+ | `@chanom/dev-config/oxfmt/base` | oxfmt rules |
25
+ | `@chanom/dev-config/oxfmt/config` | alias of `oxfmt/base` |
26
+
27
+ ## Usage
28
+
29
+ ### React app
30
+
31
+ `oxlint.config.ts`:
32
+
33
+ ```ts
34
+ import oxlintConfig from '@chanom/dev-config/oxlint/config';
35
+
36
+ export default oxlintConfig;
37
+ ```
38
+
39
+ `oxfmt.config.ts`:
40
+
41
+ ```ts
42
+ import oxfmtConfig from '@chanom/dev-config/oxfmt/config';
43
+
44
+ export default oxfmtConfig;
45
+ ```
46
+
47
+ ### Library or Node package
48
+
49
+ `oxlint.config.ts`:
50
+
51
+ ```ts
52
+ import oxlintConfig from '@chanom/dev-config/oxlint/base';
53
+
54
+ export default oxlintConfig;
55
+ ```
56
+
57
+ ### Extending the base config
58
+
59
+ ```ts
60
+ import baseConfig from '@chanom/dev-config/oxlint/base';
61
+ import { defineConfig } from 'oxlint';
62
+
63
+ export default defineConfig({
64
+ extends: [baseConfig],
65
+ plugins: ['typescript', 'unicorn', 'oxc'],
66
+ rules: {
67
+ 'no-console': 'off',
68
+ },
69
+ });
70
+ ```
71
+
72
+ ## Ignored paths
73
+
74
+ The lint configs ignore the usual build artifacts by default:
75
+
76
+ - `**/node_modules/**`
77
+ - `**/.turbo/**`
78
+ - `**/dist/**`
79
+ - `**/build/**`
80
+ - `**/storybook-static/**`
81
+ - `**/env.d.ts` (config only)
82
+
83
+ Add project-specific ignores in your local `oxlint.config.ts` if needed.
84
+
85
+ ## What you get
86
+
87
+ ### oxlint base
88
+
89
+ - `correctness` rules are errors
90
+ - `no-explicit-any` as error
91
+ - `no-console` as error
92
+ - `no-unused-vars` as error, ignoring `_`-prefixed names
93
+ - `typescript/consistent-type-definitions` as error
94
+ - `typescript/consistent-type-imports` as error
95
+ - `typescript/no-deprecated` as warning
96
+
97
+ ### oxlint config (React)
98
+
99
+ Everything in **base**, plus:
100
+
101
+ - `react` and `jsx-a11y` plugins
102
+ - `react/rules-of-hooks` as error
103
+ - `react-hooks/exhaustive-deps` as warning
104
+ - `no-restricted-imports` blocks default imports of `react` and `zod`
@@ -0,0 +1,26 @@
1
+ //#region src/oxfmt/base-config.d.ts
2
+ declare const _default: {
3
+ useTabs: false;
4
+ tabWidth: number;
5
+ printWidth: number;
6
+ singleQuote: true;
7
+ jsxSingleQuote: false;
8
+ quoteProps: "as-needed";
9
+ trailingComma: "all";
10
+ semi: true;
11
+ arrowParens: "always";
12
+ bracketSameLine: false;
13
+ bracketSpacing: true;
14
+ ignorePatterns: string[];
15
+ overrides: {
16
+ files: string[];
17
+ options: {
18
+ singleQuote: true;
19
+ };
20
+ }[];
21
+ sortImports: {
22
+ groups: (string | string[])[];
23
+ };
24
+ };
25
+ //#endregion
26
+ export { _default as default };
@@ -0,0 +1,47 @@
1
+ import { defineConfig } from "oxfmt";
2
+ //#region src/oxfmt/base-config.ts
3
+ var base_config_default = defineConfig({
4
+ useTabs: false,
5
+ tabWidth: 2,
6
+ printWidth: 100,
7
+ singleQuote: true,
8
+ jsxSingleQuote: false,
9
+ quoteProps: "as-needed",
10
+ trailingComma: "all",
11
+ semi: true,
12
+ arrowParens: "always",
13
+ bracketSameLine: false,
14
+ bracketSpacing: true,
15
+ ignorePatterns: [
16
+ ".agents/skills/**/*.md",
17
+ ".claude/skills/**/*.md",
18
+ "**/dist/**",
19
+ "**/node_modules/**",
20
+ "**/build/**",
21
+ "**/.turbo/**",
22
+ "**/storybook-static/**"
23
+ ],
24
+ overrides: [{
25
+ files: ["**/*.yaml"],
26
+ options: { singleQuote: true }
27
+ }],
28
+ sortImports: { groups: [
29
+ "type-import",
30
+ ["value-builtin", "value-external"],
31
+ "type-internal",
32
+ "value-internal",
33
+ [
34
+ "type-parent",
35
+ "type-sibling",
36
+ "type-index"
37
+ ],
38
+ [
39
+ "value-parent",
40
+ "value-sibling",
41
+ "value-index"
42
+ ],
43
+ "unknown"
44
+ ] }
45
+ });
46
+ //#endregion
47
+ export { base_config_default as default };
@@ -0,0 +1,2 @@
1
+ import _default from "./base-config.js";
2
+ export { _default as default };
@@ -0,0 +1,5 @@
1
+ import base_config_default from "./base-config.js";
2
+ //#region src/oxfmt/index.ts
3
+ var oxfmt_default = base_config_default;
4
+ //#endregion
5
+ export { oxfmt_default as default };
@@ -0,0 +1,27 @@
1
+ //#region src/oxlint/base-config.d.ts
2
+ declare const _default: {
3
+ plugins: "typescript"[];
4
+ categories: {
5
+ correctness: "error";
6
+ };
7
+ rules: {
8
+ 'no-explicit-any': "error";
9
+ 'no-unused-expressions': "off";
10
+ 'no-this-alias': "off";
11
+ 'no-console': "error";
12
+ 'no-unused-vars': ["error", {
13
+ argsIgnorePattern: string;
14
+ varsIgnorePattern: string;
15
+ caughtErrorsIgnorePattern: string;
16
+ }];
17
+ /**
18
+ * TypeScript Rules
19
+ */
20
+ 'typescript/no-deprecated': "warn";
21
+ 'typescript/consistent-type-definitions': "error";
22
+ 'typescript/consistent-type-imports': "error";
23
+ };
24
+ ignorePatterns: string[];
25
+ };
26
+ //#endregion
27
+ export { _default as default };
@@ -0,0 +1,26 @@
1
+ import { defineConfig } from "oxlint";
2
+ //#region src/oxlint/base-config.ts
3
+ var base_config_default = defineConfig({
4
+ plugins: ["typescript"],
5
+ categories: { correctness: "error" },
6
+ rules: {
7
+ "no-explicit-any": "error",
8
+ "no-unused-expressions": "off",
9
+ "no-this-alias": "off",
10
+ "no-console": "error",
11
+ "no-unused-vars": ["error", {
12
+ argsIgnorePattern: "^_",
13
+ varsIgnorePattern: "^_",
14
+ caughtErrorsIgnorePattern: "^_"
15
+ }],
16
+ /**
17
+ * TypeScript Rules
18
+ */
19
+ "typescript/no-deprecated": "warn",
20
+ "typescript/consistent-type-definitions": "error",
21
+ "typescript/consistent-type-imports": "error"
22
+ },
23
+ ignorePatterns: ["**/node_modules/**", "**/.turbo/**"]
24
+ });
25
+ //#endregion
26
+ export { base_config_default as default };
@@ -0,0 +1,45 @@
1
+ //#region src/oxlint/index.d.ts
2
+ declare const _default: {
3
+ extends: {
4
+ plugins: "typescript"[];
5
+ categories: {
6
+ correctness: "error";
7
+ };
8
+ rules: {
9
+ 'no-explicit-any': "error";
10
+ 'no-unused-expressions': "off";
11
+ 'no-this-alias': "off";
12
+ 'no-console': "error";
13
+ 'no-unused-vars': ["error", {
14
+ argsIgnorePattern: string;
15
+ varsIgnorePattern: string;
16
+ caughtErrorsIgnorePattern: string;
17
+ }];
18
+ 'typescript/no-deprecated': "warn";
19
+ 'typescript/consistent-type-definitions': "error";
20
+ 'typescript/consistent-type-imports': "error";
21
+ };
22
+ ignorePatterns: string[];
23
+ }[];
24
+ plugins: ("react" | "jsx-a11y")[];
25
+ categories: {
26
+ correctness: "error";
27
+ };
28
+ rules: {
29
+ 'no-restricted-imports': ["error", {
30
+ paths: {
31
+ name: string;
32
+ importNames: string[];
33
+ message: string;
34
+ }[];
35
+ }];
36
+ /**
37
+ * React Rules
38
+ */
39
+ 'react-hooks/exhaustive-deps': "warn";
40
+ 'react/rules-of-hooks': "error";
41
+ };
42
+ ignorePatterns: string[];
43
+ };
44
+ //#endregion
45
+ export { _default as default };
@@ -0,0 +1,32 @@
1
+ import base_config_default from "./base-config.js";
2
+ import { defineConfig } from "oxlint";
3
+ //#region src/oxlint/index.ts
4
+ var oxlint_default = defineConfig({
5
+ extends: [base_config_default],
6
+ plugins: ["react", "jsx-a11y"],
7
+ categories: { correctness: "error" },
8
+ rules: {
9
+ "no-restricted-imports": ["error", { paths: [{
10
+ name: "react",
11
+ importNames: ["default"],
12
+ message: "Do not import React as default. Use named imports instead."
13
+ }, {
14
+ name: "zod",
15
+ importNames: ["default"],
16
+ message: "Do not import Zod as default. Use named imports instead."
17
+ }] }],
18
+ /**
19
+ * React Rules
20
+ */
21
+ "react-hooks/exhaustive-deps": "warn",
22
+ "react/rules-of-hooks": "error"
23
+ },
24
+ ignorePatterns: [
25
+ "**/env.d.ts",
26
+ "**/storybook-static/**",
27
+ "**/dist/**",
28
+ "**/build/**"
29
+ ]
30
+ });
31
+ //#endregion
32
+ export { oxlint_default as default };
package/package.json CHANGED
@@ -1,26 +1,46 @@
1
1
  {
2
2
  "name": "@chanom/dev-config",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Shared oxlint and oxfmt config",
5
5
  "files": [
6
- "oxfmt",
7
- "oxlint"
6
+ "dist"
8
7
  ],
9
8
  "type": "module",
10
9
  "exports": {
11
- "./oxfmt/config": "./oxfmt/index.ts",
12
- "./oxfmt/base": "./oxfmt/base-config.ts",
13
- "./oxlint/config": "./oxlint/index.ts",
14
- "./oxlint/base": "./oxlint/base-config.ts"
10
+ "./oxfmt/config": {
11
+ "types": "./dist/oxfmt/index.d.ts",
12
+ "default": "./dist/oxfmt/index.js"
13
+ },
14
+ "./oxfmt/base": {
15
+ "types": "./dist/oxfmt/base-config.d.ts",
16
+ "default": "./dist/oxfmt/base-config.js"
17
+ },
18
+ "./oxlint/config": {
19
+ "types": "./dist/oxlint/index.d.ts",
20
+ "default": "./dist/oxlint/index.js"
21
+ },
22
+ "./oxlint/base": {
23
+ "types": "./dist/oxlint/base-config.d.ts",
24
+ "default": "./dist/oxlint/base-config.js"
25
+ }
15
26
  },
16
27
  "publishConfig": {
17
28
  "access": "public"
18
29
  },
19
30
  "devDependencies": {
20
- "@tsconfig/node-ts": "23.6.4"
31
+ "@tsconfig/node-lts": "24.0.0",
32
+ "@tsconfig/node-ts": "23.6.4",
33
+ "oxfmt": "0.56.0",
34
+ "oxlint": "1.71.0",
35
+ "tsdown": "0.22.3",
36
+ "typescript": "6.0.3"
21
37
  },
22
38
  "peerDependencies": {
23
39
  "oxfmt": "0.56.0",
24
40
  "oxlint": "1.71.0"
41
+ },
42
+ "scripts": {
43
+ "build": "tsdown",
44
+ "dev": "tsdown --watch"
25
45
  }
26
46
  }
@@ -1,43 +0,0 @@
1
- import { defineConfig } from 'oxfmt';
2
-
3
- export default defineConfig({
4
- useTabs: false,
5
- tabWidth: 2,
6
- printWidth: 100,
7
- singleQuote: true,
8
- jsxSingleQuote: false,
9
- quoteProps: 'as-needed',
10
- trailingComma: 'all',
11
- semi: true,
12
- arrowParens: 'always',
13
- bracketSameLine: false,
14
- bracketSpacing: true,
15
- ignorePatterns: [
16
- '.agents/skills/**/*.md',
17
- '.claude/skills/**/*.md',
18
- '**/dist/**',
19
- '**/node_modules/**',
20
- '**/build/**',
21
- '**/.turbo/**',
22
- '**/storybook-static/**',
23
- ],
24
- overrides: [
25
- {
26
- files: ['**/*.yaml'],
27
- options: {
28
- singleQuote: true,
29
- },
30
- },
31
- ],
32
- sortImports: {
33
- groups: [
34
- 'type-import',
35
- ['value-builtin', 'value-external'],
36
- 'type-internal',
37
- 'value-internal',
38
- ['type-parent', 'type-sibling', 'type-index'],
39
- ['value-parent', 'value-sibling', 'value-index'],
40
- 'unknown',
41
- ],
42
- },
43
- });
package/oxfmt/index.ts DELETED
@@ -1,3 +0,0 @@
1
- import baseConfig from './base-config.ts';
2
-
3
- export default baseConfig;
@@ -1,29 +0,0 @@
1
- import { defineConfig } from 'oxlint';
2
-
3
- export default defineConfig({
4
- plugins: ['typescript'],
5
- categories: {
6
- correctness: 'error',
7
- },
8
- rules: {
9
- 'no-explicit-any': 'error',
10
- 'no-unused-expressions': 'off',
11
- 'no-this-alias': 'off',
12
- 'no-console': 'error',
13
- 'no-unused-vars': [
14
- 'error',
15
- {
16
- argsIgnorePattern: '^_',
17
- varsIgnorePattern: '^_',
18
- caughtErrorsIgnorePattern: '^_',
19
- },
20
- ],
21
- /**
22
- * TypeScript Rules
23
- */
24
- 'typescript/no-deprecated': 'warn',
25
- 'typescript/consistent-type-definitions': 'error',
26
- 'typescript/consistent-type-imports': 'error',
27
- },
28
- ignorePatterns: ['**/node_modules/**', '**/.turbo/**'],
29
- });
package/oxlint/index.ts DELETED
@@ -1,36 +0,0 @@
1
- import { defineConfig } from 'oxlint';
2
-
3
- import baseConfig from './base-config.ts';
4
-
5
- export default defineConfig({
6
- extends: [baseConfig],
7
- plugins: ['react', 'jsx-a11y'],
8
- categories: {
9
- correctness: 'error',
10
- },
11
- rules: {
12
- 'no-restricted-imports': [
13
- 'error',
14
- {
15
- paths: [
16
- {
17
- name: 'react',
18
- importNames: ['default'],
19
- message: 'Do not import React as default. Use named imports instead.',
20
- },
21
- {
22
- name: 'zod',
23
- importNames: ['default'],
24
- message: 'Do not import Zod as default. Use named imports instead.',
25
- },
26
- ],
27
- },
28
- ],
29
- /**
30
- * React Rules
31
- */
32
- 'react-hooks/exhaustive-deps': 'warn',
33
- 'react/rules-of-hooks': 'error',
34
- },
35
- ignorePatterns: ['**/env.d.ts', '**/storybook-static/**', '**/dist/**', '**/build/**'],
36
- });