Skip to content

Commit ca97714

Browse files
chore: resolve main merge conflicts + propose plan to lint packages/*/index.mjs (#5)
1 parent edf1cc0 commit ca97714

File tree

12 files changed

+202
-153
lines changed

12 files changed

+202
-153
lines changed

packages/eslint-config/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ This shareable config brings along the necessary plugins/configs internally (XO
1919
Create `eslint.config.js` in your repo root:
2020

2121
```js
22-
import config from "@mikecbrant/eslint-config";
23-
export default config;
22+
import config from '@mikecbrant/eslint-config'
23+
export default config
2424
```
2525

2626
Key strict rules (all error):

packages/eslint-config/config.mjs

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import tsPlugin from '@typescript-eslint/eslint-plugin'
2+
import tsParser from '@typescript-eslint/parser'
3+
import xoTypeScript from 'eslint-config-xo-typescript'
4+
import importPlugin from 'eslint-plugin-import'
5+
import sonarjs from 'eslint-plugin-sonarjs'
6+
import unicornPlugin from 'eslint-plugin-unicorn'
7+
import unusedImports from 'eslint-plugin-unused-imports'
8+
9+
export default [
10+
// Base XO TypeScript config (flat)
11+
...xoTypeScript,
12+
13+
// SonarJS recommended (flat)
14+
sonarjs.configs.recommended,
15+
16+
// Strict overlays and additional plugins
17+
{
18+
name: '@mikecbrant/eslint-config/strict-overrides',
19+
files: [
20+
'**/*.js',
21+
'**/*.mjs',
22+
'**/*.jsx',
23+
'**/*.ts',
24+
'**/*.mts',
25+
'**/*.tsx',
26+
'**/*.d.ts',
27+
],
28+
plugins: {
29+
'@typescript-eslint': tsPlugin,
30+
import: importPlugin,
31+
unicorn: unicornPlugin,
32+
'unused-imports': unusedImports,
33+
},
34+
languageOptions: {
35+
ecmaVersion: 'latest',
36+
sourceType: 'module',
37+
parser: tsParser,
38+
parserOptions: {
39+
// Enable type-aware rules without hardcoding absolute tsconfig paths
40+
projectService: true,
41+
},
42+
},
43+
settings: {
44+
'import/resolver': {
45+
typescript: { alwaysTryTypes: true },
46+
},
47+
},
48+
rules: {
49+
// Confirmed strict thresholds (errors)
50+
'max-lines-per-function': [
51+
'error',
52+
{ max: 60, skipComments: true, skipBlankLines: true },
53+
],
54+
complexity: ['error', 10],
55+
'max-depth': ['error', 3],
56+
'max-params': ['error', 4],
57+
58+
// TS hygiene
59+
'@typescript-eslint/consistent-type-imports': [
60+
'error',
61+
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
62+
],
63+
'@typescript-eslint/no-floating-promises': 'error',
64+
65+
// Imports hygiene & sorting
66+
'import/no-duplicates': 'error',
67+
'import/order': [
68+
'error',
69+
{
70+
groups: [
71+
['builtin', 'external'],
72+
'internal',
73+
'parent',
74+
'sibling',
75+
'index',
76+
'object',
77+
'type',
78+
],
79+
alphabetize: { order: 'asc', caseInsensitive: true },
80+
'newlines-between': 'always',
81+
},
82+
],
83+
'unused-imports/no-unused-imports': 'error',
84+
85+
// Misc
86+
'no-console': 'error',
87+
88+
// Tame a few unicorn defaults
89+
'unicorn/prevent-abbreviations': 'off',
90+
'unicorn/no-null': 'off',
91+
},
92+
},
93+
94+
// Explicitly omit CommonJS and TypeScript CJS
95+
{ ignores: ['**/*.cjs', '**/*.cts'] },
96+
]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Local, minimal flat config for linting this package's `.mjs` files.
2+
// Keep this JS-only to avoid TS typed-rule requirements.
3+
import importPlugin from 'eslint-plugin-import'
4+
import unusedImports from 'eslint-plugin-unused-imports'
5+
6+
export default [
7+
{
8+
files: ['*.mjs'],
9+
languageOptions: {
10+
ecmaVersion: 2023,
11+
sourceType: 'module',
12+
},
13+
plugins: {
14+
import: importPlugin,
15+
'unused-imports': unusedImports,
16+
},
17+
rules: {
18+
'import/no-duplicates': 'error',
19+
'import/order': [
20+
'error',
21+
{
22+
groups: [
23+
['builtin', 'external'],
24+
'internal',
25+
'parent',
26+
'sibling',
27+
'index',
28+
'object',
29+
'type',
30+
],
31+
alphabetize: { order: 'asc', caseInsensitive: true },
32+
'newlines-between': 'always',
33+
},
34+
],
35+
'unused-imports/no-unused-imports': 'error',
36+
},
37+
},
38+
{ ignores: ['**/*.cjs', '**/*.cts'] },
39+
]

packages/eslint-config/index.mjs

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1 @@
1-
import xoTypeScript from "eslint-config-xo-typescript";
2-
import tsParser from "@typescript-eslint/parser";
3-
import tsPlugin from "@typescript-eslint/eslint-plugin";
4-
import importPlugin from "eslint-plugin-import";
5-
import unicornPlugin from "eslint-plugin-unicorn";
6-
import sonarjs from "eslint-plugin-sonarjs";
7-
import unusedImports from "eslint-plugin-unused-imports";
8-
9-
export default [
10-
// Base XO TypeScript config (flat)
11-
...xoTypeScript,
12-
13-
// SonarJS recommended (flat)
14-
sonarjs.configs.recommended,
15-
16-
// Strict overlays and additional plugins
17-
{
18-
name: "@mikecbrant/eslint-config/strict-overrides",
19-
files: [
20-
"**/*.js",
21-
"**/*.mjs",
22-
"**/*.jsx",
23-
"**/*.ts",
24-
"**/*.mts",
25-
"**/*.tsx",
26-
"**/*.d.ts",
27-
],
28-
plugins: {
29-
"@typescript-eslint": tsPlugin,
30-
import: importPlugin,
31-
unicorn: unicornPlugin,
32-
"unused-imports": unusedImports,
33-
},
34-
languageOptions: {
35-
ecmaVersion: "latest",
36-
sourceType: "module",
37-
parser: tsParser,
38-
parserOptions: {
39-
// Enable type-aware rules without hardcoding absolute tsconfig paths
40-
projectService: true,
41-
},
42-
},
43-
settings: {
44-
"import/resolver": {
45-
typescript: { alwaysTryTypes: true },
46-
},
47-
},
48-
rules: {
49-
// Confirmed strict thresholds (errors)
50-
"max-lines-per-function": [
51-
"error",
52-
{ max: 60, skipComments: true, skipBlankLines: true },
53-
],
54-
complexity: ["error", 10],
55-
"max-depth": ["error", 3],
56-
"max-params": ["error", 4],
57-
58-
// TS hygiene
59-
"@typescript-eslint/consistent-type-imports": [
60-
"error",
61-
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
62-
],
63-
"@typescript-eslint/no-floating-promises": "error",
64-
65-
// Imports hygiene & sorting
66-
"import/no-duplicates": "error",
67-
"import/order": [
68-
"error",
69-
{
70-
groups: [
71-
["builtin", "external"],
72-
"internal",
73-
"parent",
74-
"sibling",
75-
"index",
76-
"object",
77-
"type",
78-
],
79-
alphabetize: { order: "asc", caseInsensitive: true },
80-
"newlines-between": "always",
81-
},
82-
],
83-
"unused-imports/no-unused-imports": "error",
84-
85-
// Misc
86-
"no-console": "error",
87-
88-
// Tame a few unicorn defaults
89-
"unicorn/prevent-abbreviations": "off",
90-
"unicorn/no-null": "off",
91-
},
92-
},
93-
94-
// Explicitly omit CommonJS and TypeScript CJS
95-
{ ignores: ["**/*.cjs", "**/*.cts"] },
96-
];
1+
export { default } from './config.mjs'
Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
{
2-
"name": "@mikecbrant/eslint-config",
3-
"version": "0.0.0",
4-
"type": "module",
5-
"exports": {
6-
".": "./index.mjs"
7-
},
8-
"engines": {
9-
"node": ">=22 <25"
10-
},
11-
"dependencies": {
12-
"eslint": "^9.0.0",
13-
"eslint-config-xo-typescript": "^8.0.0",
14-
"@typescript-eslint/parser": "^8.0.0",
15-
"@typescript-eslint/eslint-plugin": "^8.0.0",
16-
"eslint-plugin-import": "^2.29.0",
17-
"eslint-import-resolver-typescript": "^3.6.0",
18-
"eslint-plugin-unicorn": "^52.0.0",
19-
"eslint-plugin-sonarjs": "^3.0.2",
20-
"eslint-plugin-unused-imports": "^4.0.0"
21-
},
22-
"publishConfig": {
23-
"access": "public"
24-
},
25-
"files": [
26-
"index.mjs",
27-
"README.md"
28-
]
2+
"name": "@mikecbrant/eslint-config",
3+
"version": "0.0.0",
4+
"type": "module",
5+
"exports": {
6+
".": "./index.mjs"
7+
},
8+
"engines": {
9+
"node": ">=22 <25"
10+
},
11+
"dependencies": {
12+
"eslint": "^9.0.0",
13+
"eslint-config-xo-typescript": "^8.0.0",
14+
"@typescript-eslint/parser": "^8.0.0",
15+
"@typescript-eslint/eslint-plugin": "^8.0.0",
16+
"eslint-plugin-import": "^2.29.0",
17+
"eslint-import-resolver-typescript": "^3.6.0",
18+
"eslint-plugin-unicorn": "^52.0.0",
19+
"eslint-plugin-sonarjs": "^3.0.2",
20+
"eslint-plugin-unused-imports": "^4.0.0"
21+
},
22+
"publishConfig": {
23+
"access": "public"
24+
},
25+
"files": [
26+
"index.mjs",
27+
"config.mjs",
28+
"README.md"
29+
]
2930
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Delegate to the published Prettier config package by name to avoid cross-package relative paths.
2+
export { default } from '@mikecbrant/prettier-config'

packages/prettier-config/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Prettier 3 config matching the Node 22+ baseline (tabs, no semicolons, single qu
1313
- Or `.prettierrc.mjs`:
1414

1515
```js
16-
export { default } from "@mikecbrant/prettier-config";
16+
export { default } from '@mikecbrant/prettier-config'
1717
```
1818

1919
Peer dependency: `prettier@^3`.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
semi: false,
3+
useTabs: true,
4+
singleQuote: true,
5+
bracketSpacing: true,
6+
bracketSameLine: false,
7+
trailingComma: 'all',
8+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Delegate to the published sibling package to avoid cross-package relative imports.
2+
export { default } from '@mikecbrant/eslint-config'

packages/prettier-config/index.mjs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
export default {
2-
semi: false,
3-
useTabs: true,
4-
singleQuote: true,
5-
bracketSpacing: true,
6-
bracketSameLine: false,
7-
trailingComma: "all",
8-
};
1+
export { default } from './config.mjs'

0 commit comments

Comments
 (0)