GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — github-docs/eslint.config.ts at main · setchy/github-docs Expand file tree/ Copy patheslint.config.tsMore file actions 275 lines (249 loc) · 8.34 KB / Copy patheslint.config.tsFile metadata and controls275 lines (249 loc) · 8.34 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 import js from '@eslint/js' import tseslint from '@typescript-eslint/eslint-plugin' import tsParser from '@typescript-eslint/parser' import github from 'eslint-plugin-github' import importPlugin from 'eslint-plugin-import' import jsxA11y from 'eslint-plugin-jsx-a11y' import primerReact from 'eslint-plugin-primer-react' import eslintComments from 'eslint-plugin-eslint-comments' import i18nText from 'eslint-plugin-i18n-text' import filenames from 'eslint-plugin-filenames' import noOnlyTests from 'eslint-plugin-no-only-tests' import prettierPlugin from 'eslint-plugin-prettier' import prettier from 'eslint-config-prettier' import globals from 'globals' import customRules from 'eslint-plugin-custom-rules' export default [ { files: ['**/*.{ts,tsx}'], languageOptions: { parser: tsParser, ecmaVersion: 2022, sourceType: 'module', globals: { ...globals.browser, ...globals.node, ...globals.commonjs, ...globals.es2020, // Fetch API types for TypeScript RequestInit: 'readonly', RequestInfo: 'readonly', HeadersInit: 'readonly', JSX: 'readonly', // Node.js types for TypeScript BufferEncoding: 'readonly', NodeJS: 'readonly', // cheerio namespace for TypeScript cheerio: 'readonly', }, parserOptions: { requireConfigFile: false, }, }, settings: { 'import/resolver': { typescript: true, node: true, }, }, plugins: { github, import: importPlugin, 'eslint-comments': eslintComments, 'i18n-text': i18nText, filenames, 'no-only-tests': noOnlyTests, prettier: prettierPlugin, '@typescript-eslint': tseslint, 'primer-react': primerReact, 'jsx-a11y': jsxA11y, 'custom-rules': customRules, }, rules: { // ESLint recommended rules ...js.configs.recommended.rules, // GitHub plugin recommended rules ...github.configs.recommended.rules, // Import plugin error rules ...importPlugin.configs.errors.rules, // TypeScript ESLint recommended rules ...tseslint.configs.recommended.rules, // Primer React recommended rules ...primerReact.configs.recommended.rules, // JSX A11y recommended rules ...jsxA11y.configs.recommended.rules, // Overrides 'import/no-extraneous-dependencies': [ 'error', { packageDir: '.', }, ], 'import/extensions': ['error', { json: 'always' }], 'no-empty': ['error', { allowEmptyCatch: true }], '@typescript-eslint/no-unused-vars': 'error', 'prefer-const': ['error', { destructuring: 'all' }], // Rules that must be disabled 'no-redeclare': 'off', // Allow function overloads in TypeScript 'i18n-text/no-en': 'off', // This rule causes eslint to not run at all 'filenames/match-regex': 'off', // This rule causes eslint to not run at all camelcase: 'off', // Many gh apis use underscores, 600+ uses // Disabled rules to review 'no-console': 'off', // 800+ // Custom rules 'custom-rules/use-custom-logger': 'error', // Disallow dangerouslySetInnerHTML; render trusted HTML via RenderedHTML / // renderHTMLString or a hast tree instead (github/docs-engineering#6619). 'custom-rules/no-dangerously-set-inner-html': 'error', // Prevent direct res.redirect() usage — use res.safeRedirect() instead // to avoid open redirect vulnerabilities via protocol-relative URLs. 'no-restricted-syntax': [ 'error', { selector: "CallExpression[callee.object.name='res'][callee.property.name='redirect']", message: 'Use res.safeRedirect() instead of res.redirect() to prevent open redirects.', }, ], }, }, // Configuration for eslint-rules directory (CommonJS JavaScript files) { files: ['src/eslint-rules/**/*.js'], languageOptions: { ecmaVersion: 2022, sourceType: 'script', globals: { ...globals.node, ...globals.commonjs, ...globals.es2020, }, }, plugins: { github, import: importPlugin, 'eslint-comments': eslintComments, filenames, 'no-only-tests': noOnlyTests, prettier: prettierPlugin, }, rules: { // ESLint recommended rules ...js.configs.recommended.rules, // GitHub plugin recommended rules ...github.configs.recommended.rules, // Import plugin error rules ...importPlugin.configs.errors.rules, // Allow CommonJS in eslint rules 'import/no-commonjs': 'off', // Overrides 'import/extensions': ['error', { json: 'always' }], 'no-empty': ['error', { allowEmptyCatch: true }], 'prefer-const': ['error', { destructuring: 'all' }], // Disabled rules 'i18n-text/no-en': 'off', 'filenames/match-regex': 'off', camelcase: 'off', 'no-console': 'off', }, }, // Client-side files that run in the browser where the server-only logger is unavailable { files: [ 'src/search/components/hooks/useAISearchAutocomplete.ts', 'src/search/components/hooks/useAISearchLocalStorageCache.ts', ], rules: { 'custom-rules/use-custom-logger': 'off', }, }, // Disable custom logger rule for logger implementation itself { files: ['src/observability/logger/**/*.{ts,js}'], rules: { 'custom-rules/use-custom-logger': 'off', }, }, // Directories not yet migrated to structured logger (see github/docs-engineering#5639) // Remove directories from this list as they are migrated { files: [ 'src/article-api/**/*.{ts,js}', 'src/audit-logs/**/*.{ts,js}', 'src/color-schemes/**/*.{ts,js}', 'src/dev-toc/**/*.{ts,js}', 'src/events/components/**/*.{ts,js}', 'src/fixtures/**/*.{ts,js}', 'src/journeys/**/*.{ts,js}', 'src/observability/lib/handle-package-not-found.ts', ], rules: { 'custom-rules/use-custom-logger': 'off', }, }, // Override for scripts, tests, workflows, content-linter, and React files (disable custom logger rule) { files: [ '**/scripts/**/*.{ts,js}', '**/tests/**/*.{ts,js}', 'src/workflows/**/*.{ts,js}', 'src/content-linter/**/*.{ts,js}', '**/*.{tsx,jsx}', // Client-side module that cannot use the server-only structured logger 'src/languages/lib/translation-utils.ts', // CLI help script — chalk-colored terminal output, not application logging 'src/rest/docs.ts', ], rules: { 'custom-rules/use-custom-logger': 'off', }, }, // Allow namespace imports for @actions/core (ESM-only in v3.0.0) { files: [ '.github/actions/**/*.ts', 'src/workflows/**/*.ts', 'src/links/scripts/**/*.ts', 'src/content-linter/scripts/**/*.ts', ], rules: { 'import/no-namespace': 'off', }, }, // Allow role="list" on list-style:none <ul>/<ol> elements in these components. // Chromium drops the implicit `list`/`listitem` roles from the accessibility tree // when list-style:none is set, so NVDA/JAWS lose list semantics and the item count; // role="list" on the <ul>/<ol> and role="listitem" on each <li> restore them and are not // actually redundant here. See github/accessibility-audits#16815. { files: [ 'src/frame/components/ui/MiniTocs/MiniTocs.tsx', 'src/landings/components/TableOfContents.tsx', 'src/frame/components/GenericError.tsx', 'src/frame/components/page-footer/LegalFooter.tsx', 'src/landings/components/ProductSelectionCard.tsx', 'src/release-notes/components/GHESReleaseNotes.tsx', 'src/landings/components/journey/JourneyLearningTracks.tsx', ], rules: { 'jsx-a11y/no-redundant-roles': [ 'error', { nav: ['navigation'], ul: ['list'], ol: ['list'], li: ['listitem'] }, ], }, }, // Ignored patterns // CodeQL scripts included because cocofix is install manually by the workflow { ignores: [ 'tmp/*', '.next/', 'rest-api-description/', 'docs-internal-data/', 'src/codeql-queries/scripts/generate-code-scanning-query-list.ts', 'src/codeql-queries/scripts/generate-code-quality-query-list.ts', 'next-env.d.ts', ], }, // Prettier config (should be last to override formatting rules) prettier, ] |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |