recommended.js 543 B

123456789101112131415161718
  1. "use strict"
  2. const getPackageJson = require("../util/get-package-json")
  3. const moduleConfig = require("./recommended-module")
  4. const scriptConfig = require("./recommended-script")
  5. module.exports = () => {
  6. const packageJson = getPackageJson()
  7. const isModule = (packageJson && packageJson.type) === "module"
  8. return {
  9. ...(isModule ? moduleConfig : scriptConfig),
  10. overrides: [
  11. { files: ["*.cjs", ".*.cjs"], ...scriptConfig },
  12. { files: ["*.mjs", ".*.mjs"], ...moduleConfig },
  13. ],
  14. }
  15. }