default-config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * @fileoverview Default configuration
  3. * @author Nicholas C. Zakas
  4. */
  5. "use strict";
  6. //-----------------------------------------------------------------------------
  7. // Requirements
  8. //-----------------------------------------------------------------------------
  9. const Rules = require("../rules");
  10. //-----------------------------------------------------------------------------
  11. // Helpers
  12. //-----------------------------------------------------------------------------
  13. const sharedDefaultConfig = [
  14. // intentionally empty config to ensure these files are globbed by default
  15. {
  16. files: ["**/*.js", "**/*.mjs"],
  17. },
  18. {
  19. files: ["**/*.cjs"],
  20. languageOptions: {
  21. sourceType: "commonjs",
  22. ecmaVersion: "latest",
  23. },
  24. },
  25. ];
  26. exports.defaultConfig = Object.freeze([
  27. {
  28. plugins: {
  29. "@": {
  30. languages: {
  31. js: require("../languages/js"),
  32. },
  33. /*
  34. * Because we try to delay loading rules until absolutely
  35. * necessary, a proxy allows us to hook into the lazy-loading
  36. * aspect of the rules map while still keeping all of the
  37. * relevant configuration inside of the config array.
  38. */
  39. rules: new Proxy(
  40. {},
  41. {
  42. get(target, property) {
  43. return Rules.get(property);
  44. },
  45. has(target, property) {
  46. return Rules.has(property);
  47. },
  48. },
  49. ),
  50. },
  51. },
  52. language: "@/js",
  53. linterOptions: {
  54. reportUnusedDisableDirectives: 1,
  55. },
  56. },
  57. // default ignores are listed here
  58. {
  59. ignores: ["**/node_modules/", ".git/"],
  60. },
  61. ...sharedDefaultConfig,
  62. ]);
  63. exports.defaultRuleTesterConfig = Object.freeze([
  64. { files: ["**"] }, // Make sure the default config matches for all files
  65. ...sharedDefaultConfig,
  66. ]);