Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 0 additions & 106 deletions .github/linters/.eslintrc.yml

This file was deleted.

117 changes: 117 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
const eslint = require('@eslint/js')
const tseslint = require('typescript-eslint')
const jestPlugin = require('eslint-plugin-jest')
const githubPlugin = require('eslint-plugin-github')
const prettierPlugin = require('eslint-plugin-prettier')
const { fixupPluginRules } = require('@eslint/compat')

module.exports = tseslint.config(
// Ignore patterns
{
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/coverage/**',
'**/*.json'
]
},

// Base ESLint recommended rules
eslint.configs.recommended,

// TypeScript recommended configurations
...tseslint.configs.recommended,

// TypeScript files configuration
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname
},
globals: {
...jestPlugin.environments.globals.globals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐞 Bug - Invalid Jest Globals: Change the Jest globals access from ...jestPlugin.environments.globals.globals to the correct property path, likely ...jestPlugin.environments.globals or use a direct object with Jest globals.

Suggested change
...jestPlugin.environments.globals.globals
...jestPlugin.environments.globals
Is this review accurate? Use 👍 or 👎 to rate it

If you want to tell us more, use /gs feedback e.g. /gs feedback this review doesn't make sense, I disagree, and it keeps repeating over and over

}
},
plugins: {
jest: jestPlugin,
github: fixupPluginRules(githubPlugin),
prettier: prettierPlugin
},
rules: {
// ESLint core rules
'camelcase': 'off',
'no-console': 'off',
'no-unused-vars': 'off',
'semi': ['error', 'never'],
'func-call-spacing': ['error', 'never'],

// Prettier integration
'prettier/prettier': 'error',

// TypeScript custom rules
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/explicit-member-accessibility': [
'error',
{ accessibility: 'no-public' }
],
'@typescript-eslint/explicit-function-return-type': [
'error',
{ allowExpressions: true }
],
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-function-type': 'warn',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/unbound-method': 'error',

// GitHub plugin rules
'eslint-comments/no-use': 'off',
'eslint-comments/no-unused-disable': 'off',
'i18n-text/no-en': 'off',
'import/no-namespace': 'off',

// Jest plugin rules
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error'
}
},

// JavaScript files configuration
{
files: ['**/*.js'],
...tseslint.configs.disableTypeChecked,
rules: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Maintainability - Missing Jest Configuration: Add Jest plugin, globals, and relevant Jest rules to the JavaScript files configuration section to ensure consistent test file linting across both TypeScript and JavaScript.

Suggested change
rules: {
languageOptions: {
globals: {
...jestPlugin.environments.globals.globals
}
},
plugins: {
jest: jestPlugin,
github: fixupPluginRules(githubPlugin),
prettier: prettierPlugin
},
rules: {
// ESLint core rules
'camelcase': 'off',
'no-console': 'off',
'no-unused-vars': 'off',
'semi': ['error', 'never'],
'func-call-spacing': ['error', 'never'],
// Prettier integration
'prettier/prettier': 'error',
// GitHub plugin rules
'eslint-comments/no-use': 'off',
'eslint-comments/no-unused-disable': 'off',
'i18n-text/no-en': 'off',
'import/no-namespace': 'off',
// Jest plugin rules
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
Is this review accurate? Use 👍 or 👎 to rate it

If you want to tell us more, use /gs feedback e.g. /gs feedback this review doesn't make sense, I disagree, and it keeps repeating over and over

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/gs feedback this sugegstion is more then 30 lines, it very scare and hard to check

// Disable TypeScript-specific rules for JavaScript files
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off'
}
}
)
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"bundle": "npm run format:write && npm run package",
"format:write": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint . -c ./.github/linters/.eslintrc.yml",
"lint": "eslint .",
"package": "ncc build --minify src/index.ts -o dist --license licenses.txt",
"test": "jest",
"all": "npm run format:write && npm run lint && npm run test && npm run package",
Expand All @@ -41,6 +41,8 @@
"@linearb/gitstream-core": "2.1.215"
},
"devDependencies": {
"@eslint/compat": "^1.2.3",
"@eslint/js": "^9.39.1",
"@jest/globals": "^30.2.0",
"@types/jest": "^30.0.0",
"@types/node": "^24.10.0",
Expand All @@ -56,7 +58,8 @@
"prettier": "^3.6.2",
"prettier-eslint": "^16.4.2",
"ts-jest": "^29.4.5",
"typescript": "^5.9.3"
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.3"
},
"jest": {
"preset": "ts-jest",
Expand Down