@adguard/aglint
Version:
Universal adblock filter list linter.
60 lines (58 loc) • 1.92 kB
JavaScript
/*
* AGLint v3.0.0 (build date: Wed, 21 May 2025 13:24:14 GMT)
* (c) 2025 AdGuard Software Ltd.
* Released under the MIT license
* https://github.com/AdguardTeam/AGLint#readme
*/
const CONFIG_FILE = 'aglint.config';
const RC_CONFIG_FILE = '.aglintrc';
const EXT_JSON = '.json';
const EXT_YAML = '.yaml';
const EXT_YML = '.yml';
const JSON_CONFIG_FILE_NAME = `${CONFIG_FILE}${EXT_JSON}`;
const YAML_CONFIG_FILE_NAME = `${CONFIG_FILE}${EXT_YAML}`;
const YML_CONFIG_FILE_NAME = `${CONFIG_FILE}${EXT_YML}`;
const JSON_RC_CONFIG_FILE_NAME = `${RC_CONFIG_FILE}${EXT_JSON}`;
const YAML_RC_CONFIG_FILE_NAME = `${RC_CONFIG_FILE}${EXT_YAML}`;
const YML_RC_CONFIG_FILE_NAME = `${RC_CONFIG_FILE}${EXT_YML}`;
/**
* Possible names of the config file
*/
const CONFIG_FILE_NAMES = new Set([
// aglint.config stuff
JSON_CONFIG_FILE_NAME,
YAML_CONFIG_FILE_NAME,
YML_CONFIG_FILE_NAME,
// .aglintrc stuff
RC_CONFIG_FILE,
JSON_RC_CONFIG_FILE_NAME,
YAML_RC_CONFIG_FILE_NAME,
YML_RC_CONFIG_FILE_NAME,
]);
/**
* Name of the ignore file
*/
const IGNORE_FILE_NAME = '.aglintignore';
/**
* Supported file extensions for lintable files. Text is the most important one, but we also
* support other possible extensions, which may occur in some cases.
*/
const SUPPORTED_EXTENSIONS = new Set([
'.txt',
'.adblock',
'.adguard',
'.ublock',
]);
/**
* Problematic paths that should be ignored by default. This is essential to provide a good
* experience for the user.
*/
const PROBLEMATIC_PATHS = [
'node_modules',
'.git',
'.hg',
'.svn',
'.DS_Store',
'Thumbs.db',
];
export { CONFIG_FILE, CONFIG_FILE_NAMES, EXT_JSON, EXT_YAML, EXT_YML, IGNORE_FILE_NAME, JSON_CONFIG_FILE_NAME, JSON_RC_CONFIG_FILE_NAME, PROBLEMATIC_PATHS, RC_CONFIG_FILE, SUPPORTED_EXTENSIONS, YAML_CONFIG_FILE_NAME, YAML_RC_CONFIG_FILE_NAME, YML_CONFIG_FILE_NAME, YML_RC_CONFIG_FILE_NAME };