Skip to content

Commit

Permalink
⬆️ chore(deps): Update ESLint version
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultyou committed Oct 7, 2024
1 parent 65af8a8 commit b8f9dc0
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 92 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

76 changes: 0 additions & 76 deletions .eslintrc.js

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/update_views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ name: Update Views and Metadata
on:
push:
paths:
- "prompts/prompt.md"
- "prompts/*/prompt.md"
- "templates/*.md"
- ".github/workflows/**/*.yml"
- "prompts/**/*.md"
- "prompts/prompt.md"
- "src/**/*.ts"
- "system_prompts/**/*.md"
- "templates/*.md"

jobs:
update_views:
Expand Down Expand Up @@ -36,7 +37,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
cache: 'npm'

- name: Install dependencies
Expand Down
146 changes: 146 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import _import from 'eslint-plugin-import';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import unusedImports from 'eslint-plugin-unused-imports';
import { fixupPluginRules } from '@eslint/compat';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
{
ignores: ['**/.eslintrc.js', 'node_modules/*', 'dist/*']
},
...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended').map((config) => ({
...config,
files: ['**/*.ts']
})),
{
files: ['**/*.ts'],
plugins: {
'@typescript-eslint': typescriptEslint,
import: fixupPluginRules(_import),
'simple-import-sort': simpleImportSort,
'unused-imports': unusedImports
},
languageOptions: {
globals: {
...globals.node,
...globals.jest
},
parser: tsParser,
ecmaVersion: 2022,
sourceType: 'module'
},
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'warn',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_'
}
],
'simple-import-sort/imports': 'off',
'simple-import-sort/exports': 'error',
'import/order': [
'error',
{
groups: [['builtin'], ['external'], ['internal'], ['parent', 'sibling', 'index']],
pathGroups: [
{
pattern: '@config',
group: 'internal'
},
{
pattern: '@core/**',
group: 'internal'
},
{
pattern: '@types',
group: 'internal'
},
{
pattern: '@utils/**',
group: 'internal'
}
],
pathGroupsExcludedImportTypes: ['builtin'],
alphabetize: {
order: 'asc',
caseInsensitive: true
},
'newlines-between': 'always'
}
],
'padding-line-between-statements': [
'warn',
{
blankLine: 'never',
prev: '*',
next: 'throw'
},
{
blankLine: 'never',
prev: ['const', 'let', 'var'],
next: '*'
},
{
blankLine: 'never',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var']
},
{
blankLine: 'always',
prev: '*',
next: ['if', 'try', 'class', 'function', 'export']
},
{
blankLine: 'always',
prev: ['if', 'try', 'class', 'function', 'export'],
next: '*'
},
{
blankLine: 'never',
prev: '*',
next: 'return'
}
],
'arrow-body-style': ['error', 'as-needed'],
'prefer-arrow-callback': [
'error',
{
allowNamedFunctions: true
}
],
'func-style': ['error', 'declaration'],
'no-multi-spaces': 'error',
'no-multiple-empty-lines': [
'error',
{
max: 1,
maxEOF: 0,
maxBOF: 0
}
]
}
}
];
10 changes: 5 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module.exports = {
testEnvironment: 'node',
testMatch: ['**/tests/**/*.test.ts'],
moduleNameMapper: {
"^@config(.*)$": "<rootDir>/src/config$1",
"^@types/(.*)$": "<rootDir>/src/types/$1",
"^@utils/(.*)$": "<rootDir>/src/utils/$1"
},
};
'^@config(.*)$': '<rootDir>/src/config$1',
'^@types/(.*)$': '<rootDir>/src/types/$1',
'^@utils/(.*)$': '<rootDir>/src/utils/$1'
}
};
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
"build": "tsc",
"format": "npm run lint:fix && npm run prettify",
"generate-metadata": "ts-node -r tsconfig-paths/register src/core/generate_metadata.ts",
"lint": "eslint '**/*.ts' --ext .ts --no-ignore",
"lint:fix": "eslint '**/*.ts' --ext .ts --no-ignore --fix",
"prettify": "prettier --write '**/*.ts'",
"lint": "eslint '**/*.{ts,js,mjs}'",
"lint:fix": "npm run lint --fix",
"prettify": "prettier --write '**/*.{ts,js,mjs}'",
"test": "jest --passWithNoTests",
"test:watch": "jest --watch",
"type-check": "tsc --noEmit",
"update": "ncu -i",
"update-views": "ts-node -r tsconfig-paths/register src/core/update_views.ts",
"validate-yaml": "yamllint '**/*.yml'"
},
},
"keywords": [
"github-actions",
"typescript",
Expand All @@ -41,6 +41,7 @@
"tsconfig-paths": "4.2.0"
},
"devDependencies": {
"@eslint/compat": "1.2.0",
"@types/jest": "29.5.13",
"@types/js-yaml": "4.0.9",
"@types/node": "22.7.5",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ES2022",
"module": "commonjs",
"declaration": true,
"outDir": "./dist",
Expand All @@ -20,5 +20,5 @@
"typeRoots": ["./src/types", "./node_modules/@types"]
},
"include": ["src/**/*", "tests/**/*"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "dist"]
}

0 comments on commit b8f9dc0

Please sign in to comment.