token-guardian
Version:
A comprehensive solution for protecting and managing API tokens and secrets
88 lines (85 loc) • 2.2 kB
JavaScript
// Polyfill structuredClone for runtimes that lack it (e.g., older Node in CI)
if (typeof globalThis.structuredClone !== 'function') {
globalThis.structuredClone = value => JSON.parse(JSON.stringify(value));
}
import js from '@eslint/js';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
export default [
js.configs.recommended,
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
Buffer: 'readonly',
process: 'readonly',
console: 'readonly',
module: 'readonly',
require: 'readonly',
__dirname: 'readonly'
}
}
},
{
files: ['**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
globals: {
Buffer: 'readonly',
process: 'readonly',
console: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
module: 'readonly',
require: 'readonly',
__dirname: 'readonly',
global: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
NodeJS: 'readonly'
}
},
plugins: {
'@typescript-eslint': tsPlugin
},
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['error', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}],
'no-console': ['warn', { allow: ['warn', 'error', 'info', 'debug', 'log'] }],
'no-unused-vars': 'off' // Turn off base rule as it can report incorrect errors
}
},
{
files: ['**/*.test.ts'],
languageOptions: {
globals: {
jest: 'readonly',
describe: 'readonly',
test: 'readonly',
it: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly'
}
}
},
{
ignores: [
'dist/**',
'coverage/**',
'node_modules/**',
'examples/**' // Ignore example files for now
]
}
];