@chronicle.app/eslint-config 0.1.0
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/LICENSE +21 -0
- package/README.md +15 -0
- package/index.js +158 -0
- package/package.json +49 -0
- package/prettier.js +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrew Louis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @chronicle.app/eslint-config
|
|
2
|
+
|
|
3
|
+
Shared ESLint 8 rules for Chronicle JavaScript and TypeScript. Install ESLint 8, TypeScript 5,
|
|
4
|
+
and Prettier 3 in the consumer, then extend this package:
|
|
5
|
+
|
|
6
|
+
```json
|
|
7
|
+
{ "extends": "@chronicle.app/eslint-config" }
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
The config is CommonJS and includes the TypeScript parser/plugins. Build output,
|
|
11
|
+
coverage, and verbatim fixtures are ignored. `prettier.js` preserves the existing
|
|
12
|
+
oclif formatting preset entry point; Chronicle's formatting preferences live in
|
|
13
|
+
`@chronicle.app/prettier-config`.
|
|
14
|
+
|
|
15
|
+
MIT. See [LICENSE](LICENSE).
|
package/index.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// Stop the config cascade at the package that extends this — without it,
|
|
3
|
+
// ESLint keeps walking up ancestor directories (e.g. out of a git worktree
|
|
4
|
+
// into an enclosing checkout) and loads plugins twice.
|
|
5
|
+
root: true,
|
|
6
|
+
extends: ['oclif', 'prettier'],
|
|
7
|
+
parser: '@typescript-eslint/parser',
|
|
8
|
+
plugins: ['@typescript-eslint', 'import'],
|
|
9
|
+
env: {
|
|
10
|
+
node: true,
|
|
11
|
+
commonjs: true,
|
|
12
|
+
},
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion: 2018,
|
|
15
|
+
sourceType: 'module',
|
|
16
|
+
},
|
|
17
|
+
ignorePatterns: [
|
|
18
|
+
// Test fixtures are verbatim platform data (e.g. Twitter's window.YTD
|
|
19
|
+
// export JS), not source.
|
|
20
|
+
'**/__fixtures__/',
|
|
21
|
+
'dist/',
|
|
22
|
+
'node_modules/',
|
|
23
|
+
'.next/',
|
|
24
|
+
'build/',
|
|
25
|
+
'coverage/',
|
|
26
|
+
'test-dist/',
|
|
27
|
+
'*.min.js',
|
|
28
|
+
'*.d.ts.map',
|
|
29
|
+
'*.js.map',
|
|
30
|
+
'*.tsbuildinfo',
|
|
31
|
+
],
|
|
32
|
+
rules: {
|
|
33
|
+
// Relaxed rules for gradual adoption
|
|
34
|
+
'no-console': 'warn',
|
|
35
|
+
'no-unused-vars': 'off', // Disable base rule in favor of TypeScript version
|
|
36
|
+
'@typescript-eslint/no-unused-vars': [
|
|
37
|
+
'warn',
|
|
38
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
// Disable problematic perfectionist rules initially
|
|
42
|
+
'perfectionist/sort-imports': 'off',
|
|
43
|
+
'perfectionist/sort-objects': 'off',
|
|
44
|
+
'perfectionist/sort-interfaces': 'off',
|
|
45
|
+
'perfectionist/sort-union-types': 'off',
|
|
46
|
+
'perfectionist/sort-classes': 'off',
|
|
47
|
+
'perfectionist/sort-named-imports': 'off',
|
|
48
|
+
'perfectionist/sort-jsx-props': 'off',
|
|
49
|
+
|
|
50
|
+
// Disable other strict rules
|
|
51
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
52
|
+
'unicorn/filename-case': 'off',
|
|
53
|
+
'unicorn/consistent-destructuring': 'off',
|
|
54
|
+
'perfectionist/sort-intersection-types': 'off',
|
|
55
|
+
'new-cap': 'warn',
|
|
56
|
+
eqeqeq: 'warn',
|
|
57
|
+
'import/no-named-as-default-member': 'warn',
|
|
58
|
+
|
|
59
|
+
// Disable more noisy rules
|
|
60
|
+
'no-useless-constructor': 'warn',
|
|
61
|
+
'no-warning-comments': 'off', // Allow TODO comments
|
|
62
|
+
'unicorn/no-object-as-default-parameter': 'off',
|
|
63
|
+
'no-await-in-loop': 'warn', // Often intentional in ETL
|
|
64
|
+
'unicorn/no-useless-switch-case': 'off',
|
|
65
|
+
'unicorn/prefer-spread': 'warn', // Array#concat() sometimes more readable
|
|
66
|
+
'guard-for-in': 'warn', // for-in loops sometimes don't need guard
|
|
67
|
+
'no-unused-expressions': 'warn', // Sometimes used for side effects
|
|
68
|
+
'n/no-extraneous-import': 'warn', // May be incorrect in monorepo
|
|
69
|
+
'n/no-unpublished-import': 'off', // Allow dev dependencies in config files
|
|
70
|
+
'no-promise-executor-return': 'warn',
|
|
71
|
+
'@typescript-eslint/ban-ts-comment': 'warn', // @ts-ignore sometimes needed
|
|
72
|
+
'unicorn/better-regex': 'off', // Subjective improvements
|
|
73
|
+
'dot-notation': 'warn', // Sometimes brackets needed
|
|
74
|
+
'unicorn/switch-case-braces': 'off', // Style preference
|
|
75
|
+
'unicorn/prefer-ternary': 'off', // if/else is often clearer
|
|
76
|
+
radix: 'off', // parseInt radix parameter not always needed
|
|
77
|
+
'unicorn/text-encoding-identifier-case': 'off', // utf-8 vs utf8 preference
|
|
78
|
+
camelcase: 'warn', // External APIs often use snake_case
|
|
79
|
+
'padding-line-between-statements': 'off', // Too aggressive formatting
|
|
80
|
+
'unicorn/no-array-reduce': 'off', // Reduce is often appropriate
|
|
81
|
+
'no-implicit-coercion': 'warn', // Sometimes intentional
|
|
82
|
+
'import/no-named-as-default': 'warn', // May be incorrect
|
|
83
|
+
'n/no-unsupported-features/es-syntax': [
|
|
84
|
+
'error',
|
|
85
|
+
{
|
|
86
|
+
version: '>=18.0.0', // Modern Node.js version with full ES2022 support
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
'n/no-unsupported-features/es-builtins': [
|
|
90
|
+
'error',
|
|
91
|
+
{
|
|
92
|
+
version: '>=18.0.0', // Modern Node.js version with full ES2022 support
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
'n/no-unsupported-features/node-builtins': [
|
|
96
|
+
'error',
|
|
97
|
+
{
|
|
98
|
+
version: '>=18.0.0', // Modern Node.js version with full Node.js builtin support
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
'n/no-missing-import': 'off', // Incompatible with TypeScript module resolution
|
|
102
|
+
'max-nested-callbacks': ['warn', 6], // Allow more nested callbacks for complex async operations
|
|
103
|
+
'max-params': ['warn', 8], // Increase from default 4 for data processing methods
|
|
104
|
+
'max-depth': ['warn', 5], // Increase from default 4 for complex data processing
|
|
105
|
+
complexity: 'off', // Disable complexity warnings
|
|
106
|
+
},
|
|
107
|
+
overrides: [
|
|
108
|
+
{
|
|
109
|
+
// Config files can use CommonJS
|
|
110
|
+
files: ['*.cjs', '*.config.js', '**/eslint-config/**/*.js', '**/prettier-config/**/*.js'],
|
|
111
|
+
env: {
|
|
112
|
+
commonjs: true,
|
|
113
|
+
},
|
|
114
|
+
globals: {
|
|
115
|
+
module: 'readonly',
|
|
116
|
+
exports: 'readonly',
|
|
117
|
+
},
|
|
118
|
+
rules: {
|
|
119
|
+
'unicorn/prefer-module': 'off',
|
|
120
|
+
'no-undef': 'off',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
// Allow scripts to use console and process.exit
|
|
125
|
+
files: ['**/scripts/**/*.ts', '**/scripts/**/*.js', '**/*.test.js', '**/*.test.ts'],
|
|
126
|
+
rules: {
|
|
127
|
+
'no-console': 'off',
|
|
128
|
+
'n/no-process-exit': 'off',
|
|
129
|
+
'unicorn/no-process-exit': 'off',
|
|
130
|
+
'unicorn/prefer-top-level-await': 'off',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
// TypeScript files have different scoping rules
|
|
135
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
136
|
+
globals: {
|
|
137
|
+
NodeJS: 'readonly', // Node.js namespace types
|
|
138
|
+
__dirname: 'readonly', // CommonJS global
|
|
139
|
+
__filename: 'readonly', // CommonJS global
|
|
140
|
+
},
|
|
141
|
+
rules: {
|
|
142
|
+
'no-redeclare': 'off', // TypeScript handles redeclaration checking
|
|
143
|
+
'@typescript-eslint/no-redeclare': 'off', // TypeScript compiler handles this better
|
|
144
|
+
'unicorn/prefer-module': 'off', // Allow CommonJS patterns in Node.js
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
// React/JSX files need different rules
|
|
149
|
+
files: ['**/*.tsx', '**/*.jsx'],
|
|
150
|
+
env: {
|
|
151
|
+
browser: true,
|
|
152
|
+
},
|
|
153
|
+
rules: {
|
|
154
|
+
'no-undef': 'off', // TypeScript handles this for React components
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chronicle.app/eslint-config",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared ESLint configuration for Chronicle packages",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"index.js",
|
|
8
|
+
"prettier.js"
|
|
9
|
+
],
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@oclif/prettier-config": "^0.2.1",
|
|
12
|
+
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
13
|
+
"@typescript-eslint/parser": "^8.17.0",
|
|
14
|
+
"eslint-config-oclif": "^5",
|
|
15
|
+
"eslint-config-prettier": "^9",
|
|
16
|
+
"eslint-plugin-import": "^2.31.0"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"eslint": "^8",
|
|
20
|
+
"prettier": "^3.6.2",
|
|
21
|
+
"typescript": "^5"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"eslint",
|
|
25
|
+
"eslint-config",
|
|
26
|
+
"chronicle"
|
|
27
|
+
],
|
|
28
|
+
"author": "Andrew Louis",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"homepage": "https://chronicle.app",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/chronicle-app/chronicle/issues/new?labels=core:eslint-config&title=[eslint-config]%20"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/chronicle-app/chronicle.git",
|
|
37
|
+
"directory": "core/eslint-config"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"registry": "https://registry.npmjs.org/"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=22.13.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"lint": "eslint index.js prettier.js"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/prettier.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@oclif/prettier-config');
|