MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / getESLintInstance

Function getESLintInstance

metro.transform.js:85–125  ·  view source on GitHub ↗

* Gets the singleton ESLint instance, initializing it if necessary. * Initializing involves reading the ESLint configuration from disk and * modifying it according to the needs of code fence removal. * * @returns {ESLint} The singleton ESLint instance.

()

Source from the content-addressed store, hash-verified

83 * @returns {ESLint} The singleton ESLint instance.
84 */
85function getESLintInstance() {
86 if (!eslintInstance) {
87 const eslintrc = require('./.eslintrc.js');
88
89 eslintrc.overrides.forEach((override) => {
90 const rules = override.rules ?? {};
91
92 // We don't want linting to fail for purely stylistic reasons.
93 rules['prettier/prettier'] = 'off';
94 // Sometimes we use `let` instead of `const` to assign variables depending on
95 // the build type.
96 rules['prefer-const'] = 'off';
97
98 override.rules = rules;
99 });
100
101 // also override the rules section
102 // We don't want linting to fail for purely stylistic reasons.
103 eslintrc.rules['prettier/prettier'] = 0;
104 // Sometimes we use `let` instead of `const` to assign variables depending on
105 // the build type.
106 eslintrc.rules['prefer-const'] = 0;
107
108 // Remove all test-related overrides. We will never lint test files here.
109 eslintrc.overrides = eslintrc.overrides.filter(
110 (override) =>
111 !(
112 (override.extends &&
113 override.extends.find(
114 (configName) =>
115 configName.includes('jest') || configName.includes('mocha'),
116 )) ||
117 (override.plugins &&
118 override.plugins.find((pluginName) => pluginName.includes('jest')))
119 ),
120 );
121
122 eslintInstance = new ESLint({ baseConfig: eslintrc, useEslintrc: false });
123 }
124 return eslintInstance;
125}

Callers 1

metro.transform.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected