/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tools/eslint/eslint-plugin-node-core.js
24 строки
519 B
Michaël Zasso
tools: move ESLint tools to tools/eslint
11 июн 2024, 09:58
Не верифицирован
11 июн 2024, 09:58
94c8178
Код
Авторство
О чём код?
'use strict'; const fs = require('fs'); const path = require('path'); let cache; module.exports = { get rules() { const RULES_DIR = module.exports.RULES_DIR; if (!RULES_DIR) return {}; if (!cache) { cache = {}; const files = fs.readdirSync(RULES_DIR) .filter((filename) => filename.endsWith('.js')); for (const file of files) { const name = file.slice(0, -3); cache[name] = require(path.resolve(RULES_DIR, file)); } } return cache; }, };