mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-20 15:33:54 +00:00
* fix(js): never format package-lock.json
prettier and eslint should never touch package-lock.json. main has a
repo rule requiring team approval when lockfiles change, so an autofix
PR touching it would hang waiting for review.
- Add .prettierignore at repo root
- Add '**/package-lock.json' to eslint shared config ignores
* fix(ci): js-autofix pushes via PR instead of direct push to main
Main now has repository rules requiring pull requests + required status
checks ("All required checks pass"), so the workflow's direct push to
main is rejected with GH013 every time eslint --fix produces changes.
Switch apply-patch to push to a dedicated bot/js-autofix branch, create
or update a PR, and enable auto-merge (squash). The PR auto-merges once
CI passes. If CI fails or main moves, the PR is auto-closed and the
branch deleted — the next run re-applies on the current state.
The two-job security split is preserved:
- generate-patch stays unprivileged (contents: read only) — it runs npm
on an ephemeral runner with zero push permissions.
- apply-patch (contents: write + pull-requests: write) still never runs
npm, never installs anything, never executes repo code — it applies
the trusted patch artifact and delivers it via PR.
112 lines
3.4 KiB
JavaScript
112 lines
3.4 KiB
JavaScript
/**
|
|
* Shared ESLint flat config for all Hermes TS workspaces.
|
|
*
|
|
* Usage in a workspace's eslint.config.mjs:
|
|
*
|
|
* import config from '../../eslint.config.shared.mjs'
|
|
*
|
|
* export default [
|
|
* ...config,
|
|
* // workspace-specific overrides here
|
|
* ]
|
|
*/
|
|
|
|
import js from '@eslint/js'
|
|
import typescriptEslint from '@typescript-eslint/eslint-plugin'
|
|
import typescriptParser from '@typescript-eslint/parser'
|
|
import perfectionist from 'eslint-plugin-perfectionist'
|
|
import reactPlugin from 'eslint-plugin-react'
|
|
import hooksPlugin from 'eslint-plugin-react-hooks'
|
|
import unusedImports from 'eslint-plugin-unused-imports'
|
|
import globals from 'globals'
|
|
|
|
export default [
|
|
{
|
|
ignores: ['**/node_modules/**', '**/dist/**', 'src/**/*.js', '**/package-lock.json']
|
|
},
|
|
js.configs.recommended,
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.node
|
|
},
|
|
parser: typescriptParser,
|
|
parserOptions: {
|
|
ecmaFeatures: { jsx: true },
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module'
|
|
}
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': typescriptEslint,
|
|
perfectionist,
|
|
react: reactPlugin,
|
|
'react-hooks': hooksPlugin,
|
|
'unused-imports': unusedImports
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
curly: ['error', 'all'],
|
|
'no-fallthrough': ['error', { allowEmptyCase: true }],
|
|
'no-undef': 'off',
|
|
'no-unused-vars': 'off',
|
|
'padding-line-between-statements': [
|
|
1,
|
|
{
|
|
blankLine: 'always',
|
|
next: [
|
|
'block-like',
|
|
'block',
|
|
'return',
|
|
'if',
|
|
'class',
|
|
'continue',
|
|
'debugger',
|
|
'break',
|
|
'multiline-const',
|
|
'multiline-let'
|
|
],
|
|
prev: '*'
|
|
},
|
|
{
|
|
blankLine: 'always',
|
|
next: '*',
|
|
prev: ['case', 'default', 'multiline-const', 'multiline-let', 'multiline-block-like']
|
|
},
|
|
{ blankLine: 'never', next: ['block', 'block-like'], prev: ['case', 'default'] },
|
|
{ blankLine: 'always', next: ['block', 'block-like'], prev: ['block', 'block-like'] },
|
|
{ blankLine: 'always', next: ['empty'], prev: 'export' },
|
|
{ blankLine: 'never', next: 'iife', prev: ['block', 'block-like', 'empty'] }
|
|
],
|
|
'perfectionist/sort-exports': ['error', { order: 'asc', type: 'natural' }],
|
|
'perfectionist/sort-imports': [
|
|
'error',
|
|
{
|
|
groups: ['side-effect', 'builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
order: 'asc',
|
|
type: 'natural'
|
|
}
|
|
],
|
|
'perfectionist/sort-jsx-props': ['error', { order: 'asc', type: 'natural' }],
|
|
'perfectionist/sort-named-exports': ['error', { order: 'asc', type: 'natural' }],
|
|
'perfectionist/sort-named-imports': ['error', { order: 'asc', type: 'natural' }],
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'unused-imports/no-unused-imports': 'error'
|
|
},
|
|
settings: {
|
|
react: { version: 'detect' }
|
|
}
|
|
},
|
|
{
|
|
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
ignores: ['**/node_modules/**', '**/dist/**'],
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
globals: { ...globals.node },
|
|
sourceType: 'module'
|
|
}
|
|
}
|
|
]
|