@@ -7,26 +7,21 @@ import {
77 includeIgnoreFile ,
88} from '@eslint/compat'
99import js from '@eslint/js'
10- import { readPackageJsonSync } from '@socketsecurity/registry/lib/packages'
1110import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
1211import { flatConfigs as origImportXFlatConfigs } from 'eslint-plugin-import-x'
1312import nodePlugin from 'eslint-plugin-n'
1413import sortDestructureKeysPlugin from 'eslint-plugin-sort-destructure-keys'
1514import unicornPlugin from 'eslint-plugin-unicorn'
16- import fastGlob from 'fast-glob'
1715import globals from 'globals'
1816import tsEslint from 'typescript-eslint'
19- import constants from '../scripts/constants.mjs'
2017
2118// Resolve current module paths for proper configuration loading.
2219const __filename = fileURLToPath ( import . meta. url )
2320const __dirname = path . dirname ( __filename )
2421const require = createRequire ( import . meta. url )
2522
26- const { gitIgnoreFile, npmPackagesPath, relNpmPackagesPath, rootTsConfigPath } =
27- constants
28-
2923const rootPath = path . dirname ( __dirname )
24+ const rootTsConfigPath = path . join ( rootPath , 'tsconfig.json' )
3025
3126// Convert Node.js globals to readonly format for ESLint configuration.
3227// This ensures Node.js built-ins are recognized but not modifiable.
@@ -56,33 +51,18 @@ const gitIgnores = {
5651// Enable only for comprehensive checks before releases.
5752if ( process . env . LINT_EXTERNAL ) {
5853 const isNotExternalGlobPattern = p => ! / (?: ^ | [ \\ / ] ) e x t e r n a l / . test ( p )
59- biomeIgnores . ignores = biomeIgnores . ignores ?. filter ( isNotExternalGlobPattern )
60- gitIgnores . ignores = gitIgnores . ignores ?. filter ( isNotExternalGlobPattern )
54+ if ( biomeIgnores . ignores ) {
55+ biomeIgnores . ignores = biomeIgnores . ignores . filter ( isNotExternalGlobPattern )
56+ }
57+ if ( gitIgnores . ignores ) {
58+ gitIgnores . ignores = gitIgnores . ignores . filter ( isNotExternalGlobPattern )
59+ }
6160}
6261
63- // OPTIMIZATION: Dynamically generate ignore patterns based on package types.
64- // This prevents ESLint from checking incompatible module types, reducing
65- // false positives and improving linting performance by skipping unnecessary files.
66- function getIgnores ( isEsm ) {
67- return constants . npmPackageNames . flatMap ( sockRegPkgName => {
68- const pkgPath = path . join ( npmPackagesPath , sockRegPkgName )
69- const { type } = readPackageJsonSync ( pkgPath )
70- const ignored = [ ]
71- if ( isEsm ? type !== 'module' : type === 'module' ) {
72- ignored . push ( `${ relNpmPackagesPath } /${ sockRegPkgName } /*` )
73- } else if ( ! isEsm ) {
74- ignored . push ( `${ relNpmPackagesPath } /${ sockRegPkgName } /*.mjs` )
75- if (
76- fastGlob . globSync ( [ '**/*.cjs' ] , {
77- cwd : pkgPath ,
78- ignores : constants . ignoreGlobs ,
79- } ) . length
80- ) {
81- ignored . push ( `${ relNpmPackagesPath } /${ sockRegPkgName } /*.js` )
82- }
83- }
84- return ignored
85- } )
62+ // OPTIMIZATION: For socket-lib (single package), no dynamic ignore patterns needed.
63+ // This is a simplified version for non-monorepo usage.
64+ function getIgnores ( _isEsm ) {
65+ return [ ]
8666}
8767
8868function getImportXFlatConfigs ( isEsm ) {
@@ -156,14 +136,14 @@ function configs(sourceType) {
156136 'error' ,
157137 {
158138 ignores : [ 'Object.groupBy' ] ,
159- version : constants . maintainedNodeVersions . current ,
139+ version : '>=22' ,
160140 } ,
161141 ] ,
162142 'n/no-unsupported-features/es-syntax' : [
163143 'error' ,
164144 {
165145 ignores : [ 'object-map-groupby' ] ,
166- version : constants . maintainedNodeVersions . current ,
146+ version : '>=22' ,
167147 } ,
168148 ] ,
169149 'n/no-unsupported-features/node-builtins' : [
@@ -182,7 +162,7 @@ function configs(sourceType) {
182162 'ReadableStream' ,
183163 'Response' ,
184164 ] ,
185- version : constants . maintainedNodeVersions . current ,
165+ version : '>=22' ,
186166 } ,
187167 ] ,
188168 'n/prefer-node-protocol' : 'error' ,
@@ -337,7 +317,7 @@ function configs(sourceType) {
337317}
338318
339319export default [
340- gitIgnoreFile ,
320+ gitIgnores ,
341321 biomeIgnores ,
342322 {
343323 ignores : [
0 commit comments