mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:51:50 +00:00
* disable slow eslint rules, remove unused disable directives Disabling these eslint rules makes saving significantly faster. These rules are not worthless, but they are usually ignored anyway, and I can't recall a specific instance when they would have caught a bug. I am proposing we disable them and then set a checkpoint in 14 days to rerun eslint with the rules enabled and see if they would have caught any bad practices. In the meantime, we will all benefit from instant saves (with eslint fixes) instead of waiting 3-5 seconds or more after each save in VS Code, which is destructive to productivity. * upgrade eslint
25 lines
715 B
TypeScript
25 lines
715 B
TypeScript
import fs from 'fs'
|
|
|
|
import { parse } from 'jsonc-parser'
|
|
import lodash from 'lodash'
|
|
|
|
import type { SourcegraphContext } from '../../src/jscontext'
|
|
|
|
import { ENVIRONMENT_CONFIG } from './environment-config'
|
|
|
|
const { SITE_CONFIG_PATH } = ENVIRONMENT_CONFIG
|
|
|
|
// Get site-config from `SITE_CONFIG_PATH` as an object with camel cased keys.
|
|
export const getSiteConfig = (): Partial<SourcegraphContext> => {
|
|
try {
|
|
const siteConfig = parse(fs.readFileSync(SITE_CONFIG_PATH, 'utf-8'))
|
|
|
|
return lodash.mapKeys(siteConfig, (_value, key) => lodash.camelCase(key))
|
|
} catch (error) {
|
|
console.log('Site config not found!', SITE_CONFIG_PATH)
|
|
console.error(error)
|
|
|
|
return {}
|
|
}
|
|
}
|