/opt/canhelp/node_modules/next/dist/esm/lib/eslint
Edit: /opt/canhelp/node_modules/next/dist/esm/lib/eslint/writeDefaultConfig.js.map (3561B)
{"version":3,"sources":["../../../src/lib/eslint/writeDefaultConfig.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport { bold, green } from '../picocolors'\nimport os from 'os'\nimport path from 'path'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport type { ConfigAvailable } from './hasEslintConfiguration'\n\nimport * as Log from '../../build/output/log'\n\nexport async function writeDefaultConfig(\n baseDir: string,\n { exists, emptyEslintrc, emptyPkgJsonConfig }: ConfigAvailable,\n selectedConfig: any,\n eslintrcFile: string | null,\n pkgJsonPath: string | null,\n packageJsonConfig: { eslintConfig: any } | null\n) {\n if (!exists && emptyEslintrc && eslintrcFile) {\n const ext = path.extname(eslintrcFile)\n\n let newFileContent\n if (ext === '.yaml' || ext === '.yml') {\n newFileContent = \"extends: 'next'\"\n } else {\n newFileContent = CommentJson.stringify(selectedConfig, null, 2)\n\n if (ext === '.js') {\n newFileContent = 'module.exports = ' + newFileContent\n }\n }\n\n await fs.writeFile(eslintrcFile, newFileContent + os.EOL)\n\n Log.info(\n `We detected an empty ESLint configuration file (${bold(\n path.basename(eslintrcFile)\n )}) and updated it for you!`\n )\n } else if (!exists && emptyPkgJsonConfig && packageJsonConfig) {\n packageJsonConfig.eslintConfig = selectedConfig\n\n if (pkgJsonPath)\n await fs.writeFile(\n pkgJsonPath,\n CommentJson.stringify(packageJsonConfig, null, 2) + os.EOL\n )\n\n Log.info(\n `We detected an empty ${bold(\n 'eslintConfig'\n )} field in package.json and updated it for you!`\n )\n } else if (!exists) {\n await fs.writeFile(\n path.join(baseDir, '.eslintrc.json'),\n CommentJson.stringify(selectedConfig, null, 2) + os.EOL\n )\n\n console.log(\n green(\n `We created the ${bold(\n '.eslintrc.json'\n )} file for you and included your selected configuration.`\n )\n )\n }\n}\n"],"names":["promises","fs","bold","green","os","path","CommentJson","Log","writeDefaultConfig","baseDir","exists","emptyEslintrc","emptyPkgJsonConfig","selectedConfig","eslintrcFile","pkgJsonPath","packageJsonConfig","ext","extname","newFileContent","stringify","writeFile","EOL","info","basename","eslintConfig","join","console","log"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,IAAI,EAAEC,KAAK,QAAQ,gBAAe;AAC3C,OAAOC,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,YAAYC,iBAAiB,kCAAiC;AAG9D,YAAYC,SAAS,yBAAwB;AAE7C,OAAO,eAAeC,mBACpBC,OAAe,EACf,EAAEC,MAAM,EAAEC,aAAa,EAAEC,kBAAkB,EAAmB,EAC9DC,cAAmB,EACnBC,YAA2B,EAC3BC,WAA0B,EAC1BC,iBAA+C;IAE/C,IAAI,CAACN,UAAUC,iBAAiBG,cAAc;QAC5C,MAAMG,MAAMZ,KAAKa,OAAO,CAACJ;QAEzB,IAAIK;QACJ,IAAIF,QAAQ,WAAWA,QAAQ,QAAQ;YACrCE,iBAAiB;QACnB,OAAO;YACLA,iBAAiBb,YAAYc,SAAS,CAACP,gBAAgB,MAAM;YAE7D,IAAII,QAAQ,OAAO;gBACjBE,iBAAiB,sBAAsBA;YACzC;QACF;QAEA,MAAMlB,GAAGoB,SAAS,CAACP,cAAcK,iBAAiBf,GAAGkB,GAAG;QAExDf,IAAIgB,IAAI,CACN,CAAC,gDAAgD,EAAErB,KACjDG,KAAKmB,QAAQ,CAACV,eACd,yBAAyB,CAAC;IAEhC,OAAO,IAAI,CAACJ,UAAUE,sBAAsBI,mBAAmB;QAC7DA,kBAAkBS,YAAY,GAAGZ;QAEjC,IAAIE,aACF,MAAMd,GAAGoB,SAAS,CAChBN,aACAT,YAAYc,SAAS,CAACJ,mBAAmB,MAAM,KAAKZ,GAAGkB,GAAG;QAG9Df,IAAIgB,IAAI,CACN,CAAC,qBAAqB,EAAErB,KACtB,gBACA,8CAA8C,CAAC;IAErD,OAAO,IAAI,CAACQ,QAAQ;QAClB,MAAMT,GAAGoB,SAAS,CAChBhB,KAAKqB,IAAI,CAACjB,SAAS,mBACnBH,YAAYc,SAAS,CAACP,gBAAgB,MAAM,KAAKT,GAAGkB,GAAG;QAGzDK,QAAQC,GAAG,CACTzB,MACE,CAAC,eAAe,EAAED,KAChB,kBACA,uDAAuD,CAAC;IAGhE;AACF","ignoreList":[0]}