Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config-schema.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @fileoverview Defines a schema for configs.
  3. * @author Sylvan Mably
  4. */
  5. "use strict";
  6. const baseConfigProperties = {
  7. env: { type: "object" },
  8. globals: { type: "object" },
  9. parser: { type: ["string", "null"] },
  10. parserOptions: { type: "object" },
  11. plugins: { type: "array" },
  12. rules: { type: "object" },
  13. settings: { type: "object" },
  14. ecmaFeatures: { type: "object" } // deprecated; logs a warning when used
  15. };
  16. const overrideProperties = Object.assign(
  17. {},
  18. baseConfigProperties,
  19. {
  20. files: {
  21. oneOf: [
  22. { type: "string" },
  23. {
  24. type: "array",
  25. items: { type: "string" },
  26. minItems: 1
  27. }
  28. ]
  29. },
  30. excludedFiles: {
  31. oneOf: [
  32. { type: "string" },
  33. {
  34. type: "array",
  35. items: { type: "string" }
  36. }
  37. ]
  38. }
  39. }
  40. );
  41. const topLevelConfigProperties = Object.assign(
  42. {},
  43. baseConfigProperties,
  44. {
  45. extends: { type: ["string", "array"] },
  46. root: { type: "boolean" },
  47. overrides: {
  48. type: "array",
  49. items: {
  50. type: "object",
  51. properties: overrideProperties,
  52. required: ["files"],
  53. additionalProperties: false
  54. }
  55. }
  56. }
  57. );
  58. const configSchema = {
  59. type: "object",
  60. properties: topLevelConfigProperties,
  61. additionalProperties: false
  62. };
  63. module.exports = configSchema;