From d8521132623858ebfbef6bee79cda8c6333948db Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Thu, 14 Dec 2023 11:13:05 +0900 Subject: [PATCH] Improve compatibility with ESLint v9 (#288) * Improve compatibility with ESLint v9 * Create eleven-beds-worry.md --- .changeset/eleven-beds-worry.md | 5 + package.json | 2 +- src/rules/flow-mapping-curly-spacing.ts | 287 ++++++++++++++++-- src/rules/flow-sequence-bracket-spacing.ts | 257 ++++++++++++++-- src/utils/ast-utils.ts | 44 +++ src/utils/index.ts | 96 +----- .../54T7-errors.json | 12 + .../54T7-input.yaml | 1 + .../54T7-output.yml | 2 + .../5C5M-errors.json | 12 + .../5C5M-input.yaml | 2 + .../5C5M-output.yml | 3 + .../C4HZ-errors.json | 12 + .../C4HZ-input.yaml | 14 + .../C4HZ-output.yml | 15 + .../KZN9-errors.json | 12 + .../KZN9-input.yaml | 3 + .../KZN9-output.yml | 4 + .../MXS3-errors.json | 12 + .../MXS3-input.yaml | 1 + .../MXS3-output.yml | 2 + .../SBG9-errors.json | 12 + .../SBG9-input.yaml | 1 + .../SBG9-output.yml | 2 + .../X38W-errors.json | 7 + .../X38W-input.yaml | 1 + .../X38W-output.yml | 2 + .../ZF4X-errors.json | 12 + .../ZF4X-input.yaml | 5 + .../ZF4X-output.yml | 6 + .../_config.json | 14 + .../5C5M-errors.json | 12 + .../5C5M-input.yaml | 2 + .../5C5M-output.yml | 3 + .../C4HZ-errors.json | 12 + .../C4HZ-input.yaml | 14 + .../C4HZ-output.yml | 15 + .../CN3R-errors.json | 22 ++ .../CN3R-input.yaml | 6 + .../CN3R-output.yml | 7 + .../F3CP-errors.json | 12 + .../F3CP-input.yaml | 2 + .../F3CP-output.yml | 3 + .../LP6E-errors.json | 7 + .../LP6E-input.yaml | 6 + .../LP6E-output.yml | 7 + .../Q88A-errors.json | 12 + .../Q88A-input.yaml | 5 + .../Q88A-output.yml | 6 + .../Q9WF-errors.json | 12 + .../Q9WF-input.yaml | 6 + .../Q9WF-output.yml | 7 + .../UDM2-errors.json | 12 + .../UDM2-input.yaml | 1 + .../UDM2-output.yml | 2 + .../UDR7-errors.json | 12 + .../UDR7-input.yaml | 2 + .../UDR7-output.yml | 3 + .../UT92-errors.json | 12 + .../UT92-input.yaml | 7 + .../UT92-output.yml | 8 + .../X38W-errors.json | 12 + .../X38W-input.yaml | 1 + .../X38W-output.yml | 2 + .../_config.json | 14 + .../5KJE-errors.json | 12 + .../5KJE-input.yaml | 2 + .../5KJE-output.yml | 3 + .../7TMG-errors.json | 7 + .../7TMG-input.yaml | 4 + .../7TMG-output.yml | 5 + .../D88J-errors.json | 12 + .../D88J-input.yaml | 1 + .../D88J-output.yml | 2 + .../DHP8-errors.json | 12 + .../DHP8-input.yaml | 1 + .../DHP8-output.yml | 2 + .../EHF6-errors.json | 7 + .../EHF6-input.yaml | 4 + .../EHF6-output.yml | 5 + .../F3CP-errors.json | 17 ++ .../F3CP-input.yaml | 2 + .../F3CP-output.yml | 3 + .../FUP4-errors.json | 22 ++ .../FUP4-input.yaml | 1 + .../FUP4-output.yml | 2 + .../LP6E-errors.json | 7 + .../LP6E-input.yaml | 6 + .../LP6E-output.yml | 7 + .../LX3P-errors.json | 12 + .../LX3P-input.yaml | 1 + .../LX3P-output.yml | 2 + .../M7NX-errors.json | 12 + .../M7NX-input.yaml | 8 + .../M7NX-output.yml | 9 + .../SBG9-errors.json | 22 ++ .../SBG9-input.yaml | 1 + .../SBG9-output.yml | 2 + .../X38W-errors.json | 22 ++ .../X38W-input.yaml | 1 + .../X38W-output.yml | 2 + .../YD5X-errors.json | 27 ++ .../YD5X-input.yaml | 3 + .../YD5X-output.yml | 4 + .../_config.json | 15 + .../6HB6-errors.json | 7 + .../6HB6-input.yaml | 12 + .../6HB6-output.yml | 12 + .../5KJE-errors.json | 12 + .../5KJE-input.yaml | 2 + .../5KJE-output.yml | 3 + .../6BFJ-errors.json | 12 + .../6BFJ-input.yaml | 3 + .../6BFJ-output.yml | 4 + .../6HB6-errors.json | 7 + .../6HB6-input.yaml | 12 + .../6HB6-output.yml | 12 + .../7TMG-errors.json | 7 + .../7TMG-input.yaml | 4 + .../7TMG-output.yml | 5 + .../DBG4-errors.json | 12 + .../DBG4-input.yaml | 12 + .../DBG4-output.yml | 13 + .../EHF6-errors.json | 7 + .../EHF6-input.yaml | 4 + .../EHF6-output.yml | 5 + .../FUP4-errors.json | 7 + .../FUP4-input.yaml | 1 + .../FUP4-output.yml | 2 + .../LP6E-errors.json | 12 + .../LP6E-input.yaml | 6 + .../LP6E-output.yml | 7 + .../LX3P-errors.json | 12 + .../LX3P-input.yaml | 1 + .../LX3P-output.yml | 2 + .../M5DY-errors.json | 22 ++ .../M5DY-input.yaml | 9 + .../M5DY-output.yml | 10 + .../Q88A-errors.json | 12 + .../Q88A-input.yaml | 5 + .../Q88A-output.yml | 6 + .../UDR7-errors.json | 12 + .../UDR7-input.yaml | 2 + .../UDR7-output.yml | 3 + .../YD5X-errors.json | 7 + .../YD5X-input.yaml | 3 + .../YD5X-output.yml | 4 + .../_config.json | 15 + .../6HB6-errors.json | 7 + .../yaml-test-suite-for-never/6HB6-input.yaml | 12 + .../yaml-test-suite-for-never/6HB6-output.yml | 12 + tools/update-fixtures.ts | 16 + 152 files changed, 1631 insertions(+), 158 deletions(-) create mode 100644 .changeset/eleven-beds-worry.md create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/_config.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-errors.json create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-input.yaml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-output.yml create mode 100644 tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/_config.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/_config.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-output.yml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/_config.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-errors.json create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-input.yaml create mode 100644 tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-output.yml diff --git a/.changeset/eleven-beds-worry.md b/.changeset/eleven-beds-worry.md new file mode 100644 index 00000000..8e3c1e6c --- /dev/null +++ b/.changeset/eleven-beds-worry.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-yml": minor +--- + +Improve compatibility with ESLint v9 diff --git a/package.json b/package.json index 43cb9011..90e605dc 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "eslint-config-prettier": "^9.0.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-plugin": "^5.0.0", - "eslint-plugin-json-schema-validator": "^4.0.0", + "eslint-plugin-json-schema-validator": "^4.7.4", "eslint-plugin-jsonc": "^2.0.0", "eslint-plugin-markdown": "^3.0.0", "eslint-plugin-n": "^16.0.1", diff --git a/src/rules/flow-mapping-curly-spacing.ts b/src/rules/flow-mapping-curly-spacing.ts index 74e74795..99764628 100644 --- a/src/rules/flow-mapping-curly-spacing.ts +++ b/src/rules/flow-mapping-curly-spacing.ts @@ -1,12 +1,19 @@ -import { - createRule, - defineWrapperListener, - getProxyNode, - getCoreRule, -} from "../utils"; +import { createRule } from "../utils"; +import type { AST } from "yaml-eslint-parser"; import { getSourceCode } from "../utils/compat"; -const coreRule = getCoreRule("object-curly-spacing"); +import { + isClosingBraceToken, + isClosingBracketToken, + isOpeningBraceToken, + isOpeningBracketToken, + isTokenOnSameLine, +} from "../utils/ast-utils"; +import type { YAMLToken } from "../types"; +interface Schema1 { + arraysInObjects?: boolean; + objectsInObjects?: boolean; +} export default createRule("flow-mapping-curly-spacing", { meta: { docs: { @@ -15,12 +22,32 @@ export default createRule("flow-mapping-curly-spacing", { extensionRule: "object-curly-spacing", layout: true, }, - fixable: coreRule.meta!.fixable, - // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ignore - hasSuggestions: (coreRule.meta as any).hasSuggestions, - schema: coreRule.meta!.schema!, - messages: coreRule.meta!.messages!, - type: coreRule.meta!.type!, + type: "layout", + fixable: "whitespace", + schema: [ + { + type: "string", + enum: ["always", "never"], + }, + { + type: "object", + properties: { + arraysInObjects: { + type: "boolean", + }, + objectsInObjects: { + type: "boolean", + }, + }, + additionalProperties: false, + }, + ], + messages: { + requireSpaceBefore: "A space is required before '{{token}}'.", + requireSpaceAfter: "A space is required after '{{token}}'.", + unexpectedSpaceBefore: "There should be no space before '{{token}}'.", + unexpectedSpaceAfter: "There should be no space after '{{token}}'.", + }, }, create(context) { const sourceCode = getSourceCode(context); @@ -28,24 +55,222 @@ export default createRule("flow-mapping-curly-spacing", { return {}; } - return defineWrapperListener(coreRule, context, { - options: context.options, - createListenerProxy(listener) { - return { - YAMLMapping(node) { - if (node.style === "flow") { - listener.ObjectExpression( - getProxyNode(node, { - type: "ObjectExpression", - get properties() { - return node.pairs; - }, - }), - ); - } - }, - }; + const spaced = context.options[0] === "always"; + + /** + * Determines whether an option is set, relative to the spacing option. + * If spaced is "always", then check whether option is set to false. + * If spaced is "never", then check whether option is set to true. + * @param option The option to exclude. + * @returns Whether or not the property is excluded. + */ + function isOptionSet(option: keyof NonNullable): boolean { + return context.options[1] + ? context.options[1][option] === !spaced + : false; + } + + const options = { + spaced, + arraysInObjectsException: isOptionSet("arraysInObjects"), + objectsInObjectsException: isOptionSet("objectsInObjects"), + isOpeningCurlyBraceMustBeSpaced(second: YAMLToken) { + const targetPenultimateType = + options.arraysInObjectsException && isOpeningBracketToken(second) + ? "YAMLSequence" + : options.objectsInObjectsException && isOpeningBraceToken(second) + ? "YAMLMapping" + : null; + + return targetPenultimateType && + sourceCode.getNodeByRangeIndex(second.range[0])?.type === + targetPenultimateType + ? !options.spaced + : options.spaced; + }, + isClosingCurlyBraceMustBeSpaced(penultimate: YAMLToken) { + const targetPenultimateType = + options.arraysInObjectsException && isClosingBracketToken(penultimate) + ? "YAMLSequence" + : options.objectsInObjectsException && + isClosingBraceToken(penultimate) + ? "YAMLMapping" + : null; + + return targetPenultimateType && + sourceCode.getNodeByRangeIndex(penultimate.range[0])?.type === + targetPenultimateType + ? !options.spaced + : options.spaced; + }, + }; + + /** + * Reports that there shouldn't be a space after the first token + * @param node The node to report in the event of an error. + * @param token The token to use for the report. + */ + function reportNoBeginningSpace(node: AST.YAMLNode, token: AST.Token) { + const nextToken = sourceCode.getTokenAfter(token, { + includeComments: true, + })!; + + context.report({ + node, + loc: { start: token.loc.end, end: nextToken.loc.start }, + messageId: "unexpectedSpaceAfter", + data: { + token: token.value, + }, + fix(fixer) { + return fixer.removeRange([token.range[1], nextToken.range[0]]); + }, + }); + } + + /** + * Reports that there shouldn't be a space before the last token + * @param node The node to report in the event of an error. + * @param token The token to use for the report. + */ + function reportNoEndingSpace(node: AST.YAMLNode, token: YAMLToken) { + const previousToken = sourceCode.getTokenBefore(token, { + includeComments: true, + })!; + + context.report({ + node, + loc: { start: previousToken.loc.end, end: token.loc.start }, + messageId: "unexpectedSpaceBefore", + data: { + token: token.value, + }, + fix(fixer) { + return fixer.removeRange([previousToken.range[1], token.range[0]]); + }, + }); + } + + /** + * Reports that there should be a space after the first token + * @param node The node to report in the event of an error. + * @param token The token to use for the report. + */ + function reportRequiredBeginningSpace( + node: AST.YAMLNode, + token: AST.Token, + ) { + context.report({ + node, + loc: token.loc, + messageId: "requireSpaceAfter", + data: { + token: token.value, + }, + fix(fixer) { + return fixer.insertTextAfter(token, " "); + }, + }); + } + + /** + * Reports that there should be a space before the last token + * @param node The node to report in the event of an error. + * @param token The token to use for the report. + */ + function reportRequiredEndingSpace(node: AST.YAMLNode, token: YAMLToken) { + context.report({ + node, + loc: token.loc, + messageId: "requireSpaceBefore", + data: { + token: token.value, + }, + fix(fixer) { + return fixer.insertTextBefore(token, " "); + }, + }); + } + + /** + * Determines if spacing in curly braces is valid. + * @param node The AST node to check. + * @param first The first token to check (should be the opening brace) + * @param second The second token to check (should be first after the opening brace) + * @param penultimate The penultimate token to check (should be last before closing brace) + * @param last The last token to check (should be closing brace) + */ + function validateBraceSpacing( + node: AST.YAMLNode, + first: AST.Token, + second: YAMLToken, + penultimate: YAMLToken, + last: YAMLToken, + ) { + if (isTokenOnSameLine(first, second)) { + const firstSpaced = sourceCode.isSpaceBetweenTokens(first, second); + + if (options.isOpeningCurlyBraceMustBeSpaced(second)) { + if (!firstSpaced) reportRequiredBeginningSpace(node, first); + } else { + if (firstSpaced && second.type !== "Line") + reportNoBeginningSpace(node, first); + } + } + + if (isTokenOnSameLine(penultimate, last)) { + const lastSpaced = sourceCode.isSpaceBetweenTokens(penultimate, last); + + if (options.isClosingCurlyBraceMustBeSpaced(penultimate)) { + if (!lastSpaced) reportRequiredEndingSpace(node, last); + } else { + if (lastSpaced) reportNoEndingSpace(node, last); + } + } + } + + /** + * Gets '}' token of an object node. + * + * Because the last token of object patterns might be a type annotation, + * this traverses tokens preceded by the last property, then returns the + * first '}' token. + * @param node The node to get. This node is an + * ObjectExpression or an ObjectPattern. And this node has one or + * more properties. + * @returns '}' token. + */ + function getClosingBraceOfObject(node: AST.YAMLMapping) { + const lastProperty = node.pairs[node.pairs.length - 1]; + + return sourceCode.getTokenAfter(lastProperty, isClosingBraceToken); + } + + /** + * Reports a given object node if spacing in curly braces is invalid. + * @param node An ObjectExpression or ObjectPattern node to check. + */ + function checkForObject(node: AST.YAMLMapping) { + if (node.pairs.length === 0) return; + + const first = sourceCode.getFirstToken(node)!; + const last = getClosingBraceOfObject(node)!; + const second = sourceCode.getTokenAfter(first, { + includeComments: true, + })!; + const penultimate = sourceCode.getTokenBefore(last, { + includeComments: true, + })!; + + validateBraceSpacing(node, first, second, penultimate, last); + } + + return { + YAMLMapping(node) { + if (node.style === "flow") { + checkForObject(node); + } }, - }); + }; }, }); diff --git a/src/rules/flow-sequence-bracket-spacing.ts b/src/rules/flow-sequence-bracket-spacing.ts index fa59df29..6b4ac923 100644 --- a/src/rules/flow-sequence-bracket-spacing.ts +++ b/src/rules/flow-sequence-bracket-spacing.ts @@ -1,12 +1,13 @@ -import { - createRule, - defineWrapperListener, - getProxyNode, - getCoreRule, -} from "../utils"; +import type { AST } from "yaml-eslint-parser"; +import { createRule } from "../utils"; import { getSourceCode } from "../utils/compat"; -const coreRule = getCoreRule("array-bracket-spacing"); +import { isTokenOnSameLine } from "../utils/ast-utils"; +interface Schema1 { + singleValue?: boolean; + objectsInArrays?: boolean; + arraysInArrays?: boolean; +} export default createRule("flow-sequence-bracket-spacing", { meta: { docs: { @@ -15,12 +16,36 @@ export default createRule("flow-sequence-bracket-spacing", { extensionRule: "array-bracket-spacing", layout: true, }, - fixable: coreRule.meta!.fixable, - // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ignore - hasSuggestions: (coreRule.meta as any).hasSuggestions, - schema: coreRule.meta!.schema!, - messages: coreRule.meta!.messages!, - type: coreRule.meta!.type!, + type: "layout", + fixable: "whitespace", + schema: [ + { + type: "string", + enum: ["always", "never"], + }, + { + type: "object", + properties: { + singleValue: { + type: "boolean", + }, + objectsInArrays: { + type: "boolean", + }, + arraysInArrays: { + type: "boolean", + }, + }, + additionalProperties: false, + }, + ], + messages: { + unexpectedSpaceAfter: "There should be no space after '{{tokenValue}}'.", + unexpectedSpaceBefore: + "There should be no space before '{{tokenValue}}'.", + missingSpaceAfter: "A space is required after '{{tokenValue}}'.", + missingSpaceBefore: "A space is required before '{{tokenValue}}'.", + }, }, create(context) { const sourceCode = getSourceCode(context); @@ -28,24 +53,194 @@ export default createRule("flow-sequence-bracket-spacing", { return {}; } - return defineWrapperListener(coreRule, context, { - options: context.options, - createListenerProxy(listener) { - return { - YAMLSequence(node) { - if (node.style === "flow") { - listener.ArrayExpression( - getProxyNode(node, { - type: "ArrayExpression", - get elements() { - return node.entries; - }, - }), - ); - } - }, - }; + const spaced = context.options[0] === "always"; + + /** + * Determines whether an option is set, relative to the spacing option. + * If spaced is "always", then check whether option is set to false. + * If spaced is "never", then check whether option is set to true. + * @param option The option to exclude. + * @returns Whether or not the property is excluded. + */ + function isOptionSet(option: keyof NonNullable) { + return context.options[1] + ? context.options[1][option] === !spaced + : false; + } + + const options = { + spaced, + singleElementException: isOptionSet("singleValue"), + objectsInArraysException: isOptionSet("objectsInArrays"), + arraysInArraysException: isOptionSet("arraysInArrays"), + isOpeningBracketMustBeSpaced(node: AST.YAMLSequence) { + if (options.singleElementException && node.entries.length === 1) { + return !options.spaced; + } + const firstElement = node.entries[0]; + return firstElement && + ((options.objectsInArraysException && isObjectType(firstElement)) || + (options.arraysInArraysException && isArrayType(firstElement))) + ? !options.spaced + : options.spaced; + }, + isClosingBracketMustBeSpaced(node: AST.YAMLSequence) { + if (options.singleElementException && node.entries.length === 1) { + return !options.spaced; + } + const lastElement = node.entries[node.entries.length - 1]; + return lastElement && + ((options.objectsInArraysException && isObjectType(lastElement)) || + (options.arraysInArraysException && isArrayType(lastElement))) + ? !options.spaced + : options.spaced; + }, + }; + + /** + * Reports that there shouldn't be a space after the first token + * @param node The node to report in the event of an error. + * @param token The token to use for the report. + */ + function reportNoBeginningSpace(node: AST.YAMLNode, token: AST.Token) { + const nextToken = sourceCode.getTokenAfter(token)!; + + context.report({ + node, + loc: { start: token.loc.end, end: nextToken.loc.start }, + messageId: "unexpectedSpaceAfter", + data: { + tokenValue: token.value, + }, + fix(fixer) { + return fixer.removeRange([token.range[1], nextToken.range[0]]); + }, + }); + } + + /** + * Reports that there shouldn't be a space before the last token + * @param node The node to report in the event of an error. + * @param token The token to use for the report. + */ + function reportNoEndingSpace(node: AST.YAMLNode, token: AST.Token) { + const previousToken = sourceCode.getTokenBefore(token)!; + + context.report({ + node, + loc: { start: previousToken.loc.end, end: token.loc.start }, + messageId: "unexpectedSpaceBefore", + data: { + tokenValue: token.value, + }, + fix(fixer) { + return fixer.removeRange([previousToken.range[1], token.range[0]]); + }, + }); + } + + /** + * Reports that there should be a space after the first token + * @param node The node to report in the event of an error. + * @param token The token to use for the report. + */ + function reportRequiredBeginningSpace( + node: AST.YAMLNode, + token: AST.Token, + ) { + context.report({ + node, + loc: token.loc, + messageId: "missingSpaceAfter", + data: { + tokenValue: token.value, + }, + fix(fixer) { + return fixer.insertTextAfter(token, " "); + }, + }); + } + + /** + * Reports that there should be a space before the last token + * @param node The node to report in the event of an error. + * @param token The token to use for the report. + */ + function reportRequiredEndingSpace(node: AST.YAMLNode, token: AST.Token) { + context.report({ + node, + loc: token.loc, + messageId: "missingSpaceBefore", + data: { + tokenValue: token.value, + }, + fix(fixer) { + return fixer.insertTextBefore(token, " "); + }, + }); + } + + /** + * Determines if a node is an object type + * @param node The node to check. + * @returns Whether or not the node is an object type. + */ + function isObjectType(node: AST.YAMLNode) { + return node && node.type === "YAMLMapping"; + } + + /** + * Determines if a node is an array type + * @param node The node to check. + * @returns Whether or not the node is an array type. + */ + function isArrayType(node: AST.YAMLNode) { + return node && node.type === "YAMLSequence"; + } + + /** + * Validates the spacing around array brackets + * @param node The node we're checking for spacing + */ + function validateArraySpacing(node: AST.YAMLSequence) { + if (options.spaced && node.entries.length === 0) return; + + const first = sourceCode.getFirstToken(node); + const last = sourceCode.getLastToken(node); + const second = sourceCode.getTokenAfter(first, { + includeComments: true, + })!; + const penultimate = sourceCode.getTokenBefore(last, { + includeComments: true, + })!; + + if (isTokenOnSameLine(first, second)) { + if (options.isOpeningBracketMustBeSpaced(node)) { + if (!sourceCode.isSpaceBetweenTokens(first, second)) + reportRequiredBeginningSpace(node, first); + } else { + if (sourceCode.isSpaceBetweenTokens(first, second)) + reportNoBeginningSpace(node, first); + } + } + + if (first !== penultimate && isTokenOnSameLine(penultimate, last)) { + if (options.isClosingBracketMustBeSpaced(node)) { + if (!sourceCode.isSpaceBetweenTokens(penultimate, last)) + reportRequiredEndingSpace(node, last); + } else { + if (sourceCode.isSpaceBetweenTokens(penultimate, last)) + reportNoEndingSpace(node, last); + } + } + } + + return { + YAMLSequence(node) { + if (node.style === "flow") { + validateArraySpacing(node); + } }, - }); + }; }, }); diff --git a/src/utils/ast-utils.ts b/src/utils/ast-utils.ts index 9f8717db..eed34ae4 100644 --- a/src/utils/ast-utils.ts +++ b/src/utils/ast-utils.ts @@ -54,3 +54,47 @@ export function isColon(token: YAMLToken | null): token is YAMLToken { export function isComma(token: YAMLToken | null): token is YAMLToken { return token != null && token.type === "Punctuator" && token.value === ","; } + +/** + * Checks if the given token is an opening square bracket token or not. + * @param token The token to check. + * @returns `true` if the token is an opening square bracket token. + */ +export function isOpeningBracketToken( + token: YAMLToken | null, +): token is YAMLToken { + return token != null && token.value === "[" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a closing square bracket token or not. + * @param token The token to check. + * @returns `true` if the token is a closing square bracket token. + */ +export function isClosingBracketToken( + token: YAMLToken | null, +): token is YAMLToken { + return token != null && token.value === "]" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is an opening brace token or not. + * @param token The token to check. + * @returns `true` if the token is an opening brace token. + */ +export function isOpeningBraceToken( + token: YAMLToken | null, +): token is YAMLToken { + return token != null && token.value === "{" && token.type === "Punctuator"; +} + +/** + * Checks if the given token is a closing brace token or not. + * @param token The token to check. + * @returns `true` if the token is a closing brace token. + */ +export function isClosingBraceToken( + token: YAMLToken | null, +): token is YAMLToken { + return token != null && token.value === "}" && token.type === "Punctuator"; +} diff --git a/src/utils/index.ts b/src/utils/index.ts index 49c1618b..12530cd9 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,17 +1,9 @@ /* eslint @typescript-eslint/no-explicit-any: off -- util */ -import type { - RuleListener, - RuleModule, - PartialRuleModule, - RuleContext, -} from "../types"; +import type { RuleModule, PartialRuleModule } from "../types"; import type { Rule } from "eslint"; -import type { AST } from "yaml-eslint-parser"; import * as yamlESLintParser from "yaml-eslint-parser"; -import debug from "debug"; import path from "path"; import { getFilename, getSourceCode } from "./compat"; -const log = debug("eslint-plugin-yml:utils/index"); /** * Define the rule. @@ -58,89 +50,3 @@ export function createRule( }, }; } - -type CoreRuleListener = { - [key: string]: (node: any) => void; -}; -/** - * Define the wrapped core rule. - */ -export function defineWrapperListener( - coreRule: Rule.RuleModule, - context: RuleContext, - proxyOptions: { - options: any[]; - createListenerProxy?: (listener: CoreRuleListener) => RuleListener; - }, -): RuleListener { - const sourceCode = getSourceCode(context); - if (!sourceCode.parserServices.isYAML) { - return {}; - } - const listener = coreRule.create({ - // @ts-expect-error -- proto - __proto__: context, - options: proxyOptions.options, - }) as RuleListener; - - const yamlListener = - proxyOptions.createListenerProxy?.(listener as CoreRuleListener) ?? - listener; - - return yamlListener; -} - -/** - * Get the proxy node - */ -export function getProxyNode(node: AST.YAMLNode, properties: any): any { - const safeKeys = new Set([ - "range", - "typeAnnotation", - ]); - const cache: any = {}; - return new Proxy(node, { - get(_t, key) { - if (key in cache) { - return cache[key]; - } - if (key in properties) { - return (cache[key] = properties[key]); - } - if (!safeKeys.has(key)) { - log(`fallback: ${String(key)}`); - } - return (node as any)[key]; - }, - }); -} - -/** - * Check whether a given value is a node. - */ -export function isNode(data: any): boolean { - return ( - data && - typeof data.type === "string" && - Array.isArray(data.range) && - data.range.length === 2 && - typeof data.range[0] === "number" && - typeof data.range[1] === "number" - ); -} - -let ruleMap: Map | null = null; - -/** - * Get the core rule implementation from the rule name - */ -export function getCoreRule(ruleName: string): Rule.RuleModule { - let map: Map; - if (ruleMap) { - map = ruleMap; - } else { - // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires -- load eslint - ruleMap = map = new (require("eslint").Linter)().getRules(); - } - return map.get(ruleName)!; -} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-errors.json new file mode 100644 index 00000000..d4fc86ad --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '{'.", + "line": 2, + "column": 1 + }, + { + "message": "A space is required before '}'.", + "line": 2, + "column": 20 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-input.yaml new file mode 100644 index 00000000..fc448be7 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-input.yaml @@ -0,0 +1 @@ +{foo: you, bar: far} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-output.yml new file mode 100644 index 00000000..1f6430e5 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-output.yml @@ -0,0 +1,2 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/54T7-input.yaml +{ foo: you, bar: far } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-errors.json new file mode 100644 index 00000000..54e6c7af --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '{'.", + "line": 3, + "column": 3 + }, + { + "message": "A space is required before '}'.", + "line": 3, + "column": 27 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-input.yaml new file mode 100644 index 00000000..07186437 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-input.yaml @@ -0,0 +1,2 @@ +- { one : two , three: four , } +- {five: six,seven : eight} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-output.yml new file mode 100644 index 00000000..398d4e9b --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-output.yml @@ -0,0 +1,3 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/5C5M-input.yaml +- { one : two , three: four , } +- { five: six,seven : eight } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-errors.json new file mode 100644 index 00000000..7c4a1036 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '{'.", + "line": 7, + "column": 19 + }, + { + "message": "A space is required before '}'.", + "line": 7, + "column": 33 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-input.yaml new file mode 100644 index 00000000..1180757d --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-input.yaml @@ -0,0 +1,14 @@ +%TAG ! tag:clarkevans.com,2002: +--- !shape + # Use the ! handle for presenting + # tag:clarkevans.com,2002:circle +- !circle + center: &ORIGIN {x: 73, y: 129} + radius: 7 +- !line + start: *ORIGIN + finish: { x: 89, y: 102 } +- !label + start: *ORIGIN + color: 0xFFEEBB + text: Pretty vector drawing. diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-output.yml new file mode 100644 index 00000000..7bb7c2fb --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-output.yml @@ -0,0 +1,15 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/C4HZ-input.yaml +%TAG ! tag:clarkevans.com,2002: +--- !shape + # Use the ! handle for presenting + # tag:clarkevans.com,2002:circle +- !circle + center: &ORIGIN { x: 73, y: 129 } + radius: 7 +- !line + start: *ORIGIN + finish: { x: 89, y: 102 } +- !label + start: *ORIGIN + color: 0xFFEEBB + text: Pretty vector drawing. diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-errors.json new file mode 100644 index 00000000..583eb70d --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '{'.", + "line": 4, + "column": 5 + }, + { + "message": "A space is required before '}'.", + "line": 4, + "column": 16 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-input.yaml new file mode 100644 index 00000000..fdff3b56 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-input.yaml @@ -0,0 +1,3 @@ +- [ YAML : separate ] +- [ : empty key entry ] +- [ {JSON: like}:adjacent ] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-output.yml new file mode 100644 index 00000000..821277c2 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-output.yml @@ -0,0 +1,4 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/KZN9-input.yaml +- [ YAML : separate ] +- [ : empty key entry ] +- [ { JSON: like }:adjacent ] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-errors.json new file mode 100644 index 00000000..baf9dafb --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '{'.", + "line": 2, + "column": 3 + }, + { + "message": "A space is required before '}'.", + "line": 2, + "column": 8 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-input.yaml new file mode 100644 index 00000000..9d8ba51e --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-input.yaml @@ -0,0 +1 @@ +- {a: b} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-output.yml new file mode 100644 index 00000000..d3fd3a9f --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-output.yml @@ -0,0 +1,2 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/MXS3-input.yaml +- { a: b } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-errors.json new file mode 100644 index 00000000..38d8edc7 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '{'.", + "line": 2, + "column": 1 + }, + { + "message": "A space is required before '}'.", + "line": 2, + "column": 22 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml new file mode 100644 index 00000000..e6e30e2a --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml @@ -0,0 +1 @@ +{a: [b, c], [d, e]: f} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-output.yml new file mode 100644 index 00000000..01b15542 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-output.yml @@ -0,0 +1,2 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml +{ a: [b, c], [d, e]: f } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-errors.json new file mode 100644 index 00000000..39b64a61 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "A space is required before '}'.", + "line": 2, + "column": 36 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml new file mode 100644 index 00000000..4772110b --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml @@ -0,0 +1 @@ +{ &a [a, &b b]: *b, *a : [c, *b, d]} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-output.yml new file mode 100644 index 00000000..1ac3f813 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-output.yml @@ -0,0 +1,2 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml +{ &a [a, &b b]: *b, *a : [c, *b, d] } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-errors.json new file mode 100644 index 00000000..5347d967 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '{'.", + "line": 2, + "column": 15 + }, + { + "message": "A space is required before '}'.", + "line": 2, + "column": 34 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-input.yaml new file mode 100644 index 00000000..7a957b23 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-input.yaml @@ -0,0 +1,5 @@ +Mark McGwire: {hr: 65, avg: 0.278} +Sammy Sosa: { + hr: 63, + avg: 0.288 + } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-output.yml new file mode 100644 index 00000000..ac7d6b36 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-output.yml @@ -0,0 +1,6 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/ZF4X-input.yaml +Mark McGwire: { hr: 65, avg: 0.278 } +Sammy Sosa: { + hr: 63, + avg: 0.288 + } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/_config.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/_config.json new file mode 100644 index 00000000..be5215ad --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-always-with-object-option/_config.json @@ -0,0 +1,14 @@ +{ + "options": [ + "always", + { + "arraysInObjects": true, + "objectsInObjects": true + } + ], + "settings": { + "yml": { + "indent": 8 + } + } +} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-errors.json new file mode 100644 index 00000000..b85508e8 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 2, + "column": 4 + }, + { + "message": "There should be no space before '}'.", + "line": 2, + "column": 30 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-input.yaml new file mode 100644 index 00000000..07186437 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-input.yaml @@ -0,0 +1,2 @@ +- { one : two , three: four , } +- {five: six,seven : eight} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-output.yml new file mode 100644 index 00000000..6e019fa6 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-output.yml @@ -0,0 +1,3 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/5C5M-input.yaml +- {one : two , three: four ,} +- {five: six,seven : eight} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-errors.json new file mode 100644 index 00000000..ed8a6f3b --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 11, + "column": 12 + }, + { + "message": "There should be no space before '}'.", + "line": 11, + "column": 26 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-input.yaml new file mode 100644 index 00000000..1180757d --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-input.yaml @@ -0,0 +1,14 @@ +%TAG ! tag:clarkevans.com,2002: +--- !shape + # Use the ! handle for presenting + # tag:clarkevans.com,2002:circle +- !circle + center: &ORIGIN {x: 73, y: 129} + radius: 7 +- !line + start: *ORIGIN + finish: { x: 89, y: 102 } +- !label + start: *ORIGIN + color: 0xFFEEBB + text: Pretty vector drawing. diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-output.yml new file mode 100644 index 00000000..735c2dd7 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-output.yml @@ -0,0 +1,15 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/C4HZ-input.yaml +%TAG ! tag:clarkevans.com,2002: +--- !shape + # Use the ! handle for presenting + # tag:clarkevans.com,2002:circle +- !circle + center: &ORIGIN {x: 73, y: 129} + radius: 7 +- !line + start: *ORIGIN + finish: {x: 89, y: 102} +- !label + start: *ORIGIN + color: 0xFFEEBB + text: Pretty vector drawing. diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-errors.json new file mode 100644 index 00000000..0f965267 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-errors.json @@ -0,0 +1,22 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 5, + "column": 3 + }, + { + "message": "There should be no space before '}'.", + "line": 5, + "column": 11 + }, + { + "message": "There should be no space after '{'.", + "line": 6, + "column": 6 + }, + { + "message": "There should be no space before '}'.", + "line": 6, + "column": 11 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-input.yaml new file mode 100644 index 00000000..8345dfc9 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-input.yaml @@ -0,0 +1,6 @@ +&flowseq [ + a: b, + &c c: d, + { &e e: f }, + &g { g: h } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-output.yml new file mode 100644 index 00000000..58a9acaf --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-output.yml @@ -0,0 +1,7 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/CN3R-input.yaml +&flowseq [ + a: b, + &c c: d, + {&e e: f}, + &g {g: h} +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-errors.json new file mode 100644 index 00000000..31a4a2bc --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 3, + "column": 2 + }, + { + "message": "There should be no space after '{'.", + "line": 3, + "column": 14 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-input.yaml new file mode 100644 index 00000000..04e631bb --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-input.yaml @@ -0,0 +1,2 @@ +--- +{ a: [b, c, { d: [e, f] } ] } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-output.yml new file mode 100644 index 00000000..1cb51dda --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-output.yml @@ -0,0 +1,3 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/F3CP-input.yaml +--- +{a: [b, c, {d: [e, f] } ] } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-errors.json new file mode 100644 index 00000000..7ff5ff7a --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 3, + "column": 4 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml new file mode 100644 index 00000000..3a609096 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml @@ -0,0 +1,6 @@ +- [a, b , c ] +- { "a" : b + , c : 'd' , + e : "f" + } +- [ ] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-output.yml new file mode 100644 index 00000000..bf447288 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-output.yml @@ -0,0 +1,7 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml +- [a, b , c ] +- {"a" : b + , c : 'd' , + e : "f" + } +- [ ] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-errors.json new file mode 100644 index 00000000..c4fcd687 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 3, + "column": 4 + }, + { + "message": "There should be no space before '}'.", + "line": 3, + "column": 9 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml new file mode 100644 index 00000000..f709dc84 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml @@ -0,0 +1,5 @@ +- [ a, b ] +- { a: b } +- "a" +- 'b' +- c diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-output.yml new file mode 100644 index 00000000..9058c738 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-output.yml @@ -0,0 +1,6 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml +- [ a, b ] +- {a: b} +- "a" +- 'b' +- c diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-errors.json new file mode 100644 index 00000000..183a1379 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 2, + "column": 2 + }, + { + "message": "There should be no space before '}'.", + "line": 2, + "column": 27 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-input.yaml new file mode 100644 index 00000000..e1e11134 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-input.yaml @@ -0,0 +1,6 @@ +{ first: Sammy, last: Sosa }: +# Statistics: + hr: # Home runs + 65 + avg: # Average + 0.278 diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-output.yml new file mode 100644 index 00000000..987c9bd3 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-output.yml @@ -0,0 +1,7 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q9WF-input.yaml +{first: Sammy, last: Sosa}: +# Statistics: + hr: # Home runs + 65 + avg: # Average + 0.278 diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-errors.json new file mode 100644 index 00000000..2560cdcf --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 2, + "column": 4 + }, + { + "message": "There should be no space before '}'.", + "line": 2, + "column": 28 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-input.yaml new file mode 100644 index 00000000..fa95c05e --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-input.yaml @@ -0,0 +1 @@ +- { url: http://example.org } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-output.yml new file mode 100644 index 00000000..e6e68f42 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-output.yml @@ -0,0 +1,2 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDM2-input.yaml +- {url: http://example.org} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-errors.json new file mode 100644 index 00000000..7c751674 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 3, + "column": 11 + }, + { + "message": "There should be no space before '}'.", + "line": 3, + "column": 33 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml new file mode 100644 index 00000000..df338477 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml @@ -0,0 +1,2 @@ +sequence: [ one, two, ] +mapping: { sky: blue, sea: green } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-output.yml new file mode 100644 index 00000000..72a15414 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-output.yml @@ -0,0 +1,3 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml +sequence: [ one, two, ] +mapping: {sky: blue, sea: green} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-errors.json new file mode 100644 index 00000000..69a7de0a --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 3, + "column": 2 + }, + { + "message": "There should be no space before '}'.", + "line": 4, + "column": 7 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-input.yaml new file mode 100644 index 00000000..bc363b1c --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-input.yaml @@ -0,0 +1,7 @@ +--- +{ matches +% : 20 } +... +--- +# Empty +... diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-output.yml new file mode 100644 index 00000000..69fa308a --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-output.yml @@ -0,0 +1,8 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/UT92-input.yaml +--- +{matches +% : 20} +... +--- +# Empty +... diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-errors.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-errors.json new file mode 100644 index 00000000..d0cb8b9d --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '{'.", + "line": 2, + "column": 2 + }, + { + "message": "A space is required before '}'.", + "line": 2, + "column": 36 + } +] diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-input.yaml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-input.yaml new file mode 100644 index 00000000..4772110b --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-input.yaml @@ -0,0 +1 @@ +{ &a [a, &b b]: *b, *a : [c, *b, d]} diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-output.yml b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-output.yml new file mode 100644 index 00000000..f17ad85d --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-output.yml @@ -0,0 +1,2 @@ +# flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/X38W-input.yaml +{&a [a, &b b]: *b, *a : [c, *b, d] } diff --git a/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/_config.json b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/_config.json new file mode 100644 index 00000000..353af075 --- /dev/null +++ b/tests/fixtures/rules/flow-mapping-curly-spacing/invalid/yaml-test-suite-for-never-with-object-option/_config.json @@ -0,0 +1,14 @@ +{ + "options": [ + "never", + { + "arraysInObjects": true, + "objectsInObjects": true + } + ], + "settings": { + "yml": { + "indent": 8 + } + } +} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-errors.json new file mode 100644 index 00000000..d72c1da8 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '['.", + "line": 3, + "column": 3 + }, + { + "message": "A space is required before ']'.", + "line": 3, + "column": 15 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-input.yaml new file mode 100644 index 00000000..cd774803 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-input.yaml @@ -0,0 +1,2 @@ +- [ one, two, ] +- [three ,four] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-output.yml new file mode 100644 index 00000000..9ac60e77 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-output.yml @@ -0,0 +1,3 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/5KJE-input.yaml +- [ one, two, ] +- [ three ,four ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-errors.json new file mode 100644 index 00000000..a856813c --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "A space is required before ']'.", + "line": 5, + "column": 8 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-input.yaml new file mode 100644 index 00000000..312847e5 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-input.yaml @@ -0,0 +1,4 @@ +--- +[ word1 +# comment +, word2] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-output.yml new file mode 100644 index 00000000..93af327a --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-output.yml @@ -0,0 +1,5 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/7TMG-input.yaml +--- +[ word1 +# comment +, word2 ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-errors.json new file mode 100644 index 00000000..f6bcdd51 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '['.", + "line": 2, + "column": 4 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 9 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-input.yaml new file mode 100644 index 00000000..8238fdf5 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-input.yaml @@ -0,0 +1 @@ +a: [b, c] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-output.yml new file mode 100644 index 00000000..f50d3783 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-output.yml @@ -0,0 +1,2 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/D88J-input.yaml +a: [ b, c ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-errors.json new file mode 100644 index 00000000..f54d1cfd --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '['.", + "line": 2, + "column": 1 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 14 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-input.yaml new file mode 100644 index 00000000..bf341586 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-input.yaml @@ -0,0 +1 @@ +[foo, bar, 42] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-output.yml new file mode 100644 index 00000000..ecb4d864 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-output.yml @@ -0,0 +1,2 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/DHP8-input.yaml +[ foo, bar, 42 ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-errors.json new file mode 100644 index 00000000..f6a65a05 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "A space is required before ']'.", + "line": 4, + "column": 15 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-input.yaml new file mode 100644 index 00000000..f69ccded --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-input.yaml @@ -0,0 +1,4 @@ +!!map { + k: !!seq + [ a, !!str b] +} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-output.yml new file mode 100644 index 00000000..2b09d16b --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-output.yml @@ -0,0 +1,5 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/EHF6-input.yaml +!!map { + k: !!seq + [ a, !!str b ] +} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-errors.json new file mode 100644 index 00000000..046fc2a0 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-errors.json @@ -0,0 +1,17 @@ +[ + { + "message": "A space is required after '['.", + "line": 3, + "column": 6 + }, + { + "message": "A space is required after '['.", + "line": 3, + "column": 18 + }, + { + "message": "A space is required before ']'.", + "line": 3, + "column": 23 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-input.yaml new file mode 100644 index 00000000..04e631bb --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-input.yaml @@ -0,0 +1,2 @@ +--- +{ a: [b, c, { d: [e, f] } ] } diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-output.yml new file mode 100644 index 00000000..617fc0f5 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-output.yml @@ -0,0 +1,3 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/F3CP-input.yaml +--- +{ a: [ b, c, { d: [ e, f ] } ] } diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-errors.json new file mode 100644 index 00000000..8cf8e612 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-errors.json @@ -0,0 +1,22 @@ +[ + { + "message": "A space is required after '['.", + "line": 2, + "column": 1 + }, + { + "message": "A space is required after '['.", + "line": 2, + "column": 5 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 10 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 11 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-input.yaml new file mode 100644 index 00000000..5f76a2e4 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-input.yaml @@ -0,0 +1 @@ +[a, [b, c]] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-output.yml new file mode 100644 index 00000000..b0e36812 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-output.yml @@ -0,0 +1,2 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/FUP4-input.yaml +[ a, [ b, c ] ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-errors.json new file mode 100644 index 00000000..d8b9783d --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "A space is required after '['.", + "line": 2, + "column": 3 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-input.yaml new file mode 100644 index 00000000..3a609096 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-input.yaml @@ -0,0 +1,6 @@ +- [a, b , c ] +- { "a" : b + , c : 'd' , + e : "f" + } +- [ ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-output.yml new file mode 100644 index 00000000..42da16f0 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-output.yml @@ -0,0 +1,7 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LP6E-input.yaml +- [ a, b , c ] +- { "a" : b + , c : 'd' , + e : "f" + } +- [ ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-errors.json new file mode 100644 index 00000000..6b0786ac --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '['.", + "line": 2, + "column": 1 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 6 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-input.yaml new file mode 100644 index 00000000..b13c841c --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-input.yaml @@ -0,0 +1 @@ +[flow]: block diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-output.yml new file mode 100644 index 00000000..7b0d73bb --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-output.yml @@ -0,0 +1,2 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/LX3P-input.yaml +[ flow ]: block diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-errors.json new file mode 100644 index 00000000..a87f2349 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '['.", + "line": 6, + "column": 7 + }, + { + "message": "A space is required before ']'.", + "line": 6, + "column": 12 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-input.yaml new file mode 100644 index 00000000..d8f46c45 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-input.yaml @@ -0,0 +1,8 @@ +--- +{ + a: [ + b, c, { + d: [e, f] + } + ] +} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-output.yml new file mode 100644 index 00000000..1ee53dd4 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-output.yml @@ -0,0 +1,9 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/M7NX-input.yaml +--- +{ + a: [ + b, c, { + d: [ e, f ] + } + ] +} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-errors.json new file mode 100644 index 00000000..00caf87c --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-errors.json @@ -0,0 +1,22 @@ +[ + { + "message": "A space is required after '['.", + "line": 2, + "column": 5 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 10 + }, + { + "message": "A space is required after '['.", + "line": 2, + "column": 13 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 18 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml new file mode 100644 index 00000000..e6e30e2a --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml @@ -0,0 +1 @@ +{a: [b, c], [d, e]: f} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-output.yml new file mode 100644 index 00000000..b98e7b10 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-output.yml @@ -0,0 +1,2 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/SBG9-input.yaml +{a: [ b, c ], [ d, e ]: f} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-errors.json new file mode 100644 index 00000000..9db026f1 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-errors.json @@ -0,0 +1,22 @@ +[ + { + "message": "A space is required after '['.", + "line": 2, + "column": 6 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 14 + }, + { + "message": "A space is required after '['.", + "line": 2, + "column": 26 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 35 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml new file mode 100644 index 00000000..4772110b --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml @@ -0,0 +1 @@ +{ &a [a, &b b]: *b, *a : [c, *b, d]} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-output.yml new file mode 100644 index 00000000..576a243c --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-output.yml @@ -0,0 +1,2 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/X38W-input.yaml +{ &a [ a, &b b ]: *b, *a : [ c, *b, d ]} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-errors.json new file mode 100644 index 00000000..9c876de1 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-errors.json @@ -0,0 +1,27 @@ +[ + { + "message": "A space is required after '['.", + "line": 2, + "column": 3 + }, + { + "message": "A space is required after '['.", + "line": 3, + "column": 3 + }, + { + "message": "A space is required before ']'.", + "line": 3, + "column": 27 + }, + { + "message": "A space is required after '['.", + "line": 4, + "column": 3 + }, + { + "message": "A space is required before ']'.", + "line": 4, + "column": 27 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-input.yaml new file mode 100644 index 00000000..cdd77706 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-input.yaml @@ -0,0 +1,3 @@ +- [name , hr, avg ] +- [Mark McGwire, 65, 0.278] +- [Sammy Sosa , 63, 0.288] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-output.yml new file mode 100644 index 00000000..b380c4a2 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-output.yml @@ -0,0 +1,4 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/YD5X-input.yaml +- [ name , hr, avg ] +- [ Mark McGwire, 65, 0.278 ] +- [ Sammy Sosa , 63, 0.288 ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/_config.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/_config.json new file mode 100644 index 00000000..bb2a4242 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-always-with-object-option/_config.json @@ -0,0 +1,15 @@ +{ + "options": [ + "always", + { + "singleValue": true, + "objectsInArrays": true, + "arraysInArrays": true + } + ], + "settings": { + "yml": { + "indent": 8 + } + } +} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-errors.json new file mode 100644 index 00000000..7d1253c2 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "There should be no space after '['.", + "line": 9, + "column": 15 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-input.yaml new file mode 100644 index 00000000..b5496c11 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-input.yaml @@ -0,0 +1,12 @@ + # Leading comment line spaces are + # neither content nor indentation. + +Not indented: + By one space: | + By four + spaces + Flow style: [ # Leading spaces + By two, # in flow style + Also by two, # are neither + Still by two # content nor + ] # indentation. diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-output.yml new file mode 100644 index 00000000..e7266d4f --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-output.yml @@ -0,0 +1,12 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-default/6HB6-input.yaml + # Leading comment line spaces are + # neither content nor indentation. + +Not indented: + By one space: | + By four + spaces + Flow style: [By two, # in flow style + Also by two, # are neither + Still by two # content nor + ] # indentation. diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-errors.json new file mode 100644 index 00000000..011e44e3 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '['.", + "line": 2, + "column": 4 + }, + { + "message": "There should be no space before ']'.", + "line": 2, + "column": 14 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-input.yaml new file mode 100644 index 00000000..cd774803 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-input.yaml @@ -0,0 +1,2 @@ +- [ one, two, ] +- [three ,four] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-output.yml new file mode 100644 index 00000000..a928fb68 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-output.yml @@ -0,0 +1,3 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/5KJE-input.yaml +- [one, two,] +- [three ,four] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-errors.json new file mode 100644 index 00000000..d3a60580 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '['.", + "line": 4, + "column": 7 + }, + { + "message": "There should be no space before ']'.", + "line": 4, + "column": 21 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-input.yaml new file mode 100644 index 00000000..19d1e3ee --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-input.yaml @@ -0,0 +1,3 @@ +--- +&mapping +&key [ &item a, b, c ]: value diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-output.yml new file mode 100644 index 00000000..b8865788 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-output.yml @@ -0,0 +1,4 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6BFJ-input.yaml +--- +&mapping +&key [&item a, b, c]: value diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-errors.json new file mode 100644 index 00000000..7d1253c2 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "There should be no space after '['.", + "line": 9, + "column": 15 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-input.yaml new file mode 100644 index 00000000..b5496c11 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-input.yaml @@ -0,0 +1,12 @@ + # Leading comment line spaces are + # neither content nor indentation. + +Not indented: + By one space: | + By four + spaces + Flow style: [ # Leading spaces + By two, # in flow style + Also by two, # are neither + Still by two # content nor + ] # indentation. diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-output.yml new file mode 100644 index 00000000..a7dcb960 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-output.yml @@ -0,0 +1,12 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/6HB6-input.yaml + # Leading comment line spaces are + # neither content nor indentation. + +Not indented: + By one space: | + By four + spaces + Flow style: [By two, # in flow style + Also by two, # are neither + Still by two # content nor + ] # indentation. diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-errors.json new file mode 100644 index 00000000..e7de159e --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "There should be no space after '['.", + "line": 3, + "column": 2 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-input.yaml new file mode 100644 index 00000000..312847e5 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-input.yaml @@ -0,0 +1,4 @@ +--- +[ word1 +# comment +, word2] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-output.yml new file mode 100644 index 00000000..c84685f1 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-output.yml @@ -0,0 +1,5 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/7TMG-input.yaml +--- +[word1 +# comment +, word2] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-errors.json new file mode 100644 index 00000000..e5928eba --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '['.", + "line": 9, + "column": 4 + }, + { + "message": "There should be no space before ']'.", + "line": 13, + "column": 29 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-input.yaml new file mode 100644 index 00000000..7ed369fb --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-input.yaml @@ -0,0 +1,12 @@ +# Outside flow collection: +- ::vector +- ": - ()" +- Up, up, and away! +- -123 +- http://example.com/foo#bar +# Inside flow collection: +- [ ::vector, + ": - ()", + "Up, up and away!", + -123, + http://example.com/foo#bar ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-output.yml new file mode 100644 index 00000000..572688f7 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-output.yml @@ -0,0 +1,13 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/DBG4-input.yaml +# Outside flow collection: +- ::vector +- ": - ()" +- Up, up, and away! +- -123 +- http://example.com/foo#bar +# Inside flow collection: +- [::vector, + ": - ()", + "Up, up and away!", + -123, + http://example.com/foo#bar] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-errors.json new file mode 100644 index 00000000..850fc57c --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "There should be no space after '['.", + "line": 4, + "column": 4 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-input.yaml new file mode 100644 index 00000000..f69ccded --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-input.yaml @@ -0,0 +1,4 @@ +!!map { + k: !!seq + [ a, !!str b] +} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-output.yml new file mode 100644 index 00000000..e64ef201 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-output.yml @@ -0,0 +1,5 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/EHF6-input.yaml +!!map { + k: !!seq + [a, !!str b] +} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-errors.json new file mode 100644 index 00000000..d9748eba --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "A space is required before ']'.", + "line": 2, + "column": 11 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-input.yaml new file mode 100644 index 00000000..5f76a2e4 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-input.yaml @@ -0,0 +1 @@ +[a, [b, c]] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-output.yml new file mode 100644 index 00000000..fbdc6726 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-output.yml @@ -0,0 +1,2 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/FUP4-input.yaml +[a, [b, c] ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-errors.json new file mode 100644 index 00000000..1af535ac --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space before ']'.", + "line": 2, + "column": 12 + }, + { + "message": "There should be no space after '['.", + "line": 7, + "column": 4 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml new file mode 100644 index 00000000..3a609096 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml @@ -0,0 +1,6 @@ +- [a, b , c ] +- { "a" : b + , c : 'd' , + e : "f" + } +- [ ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-output.yml new file mode 100644 index 00000000..1ffe93da --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-output.yml @@ -0,0 +1,7 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LP6E-input.yaml +- [a, b , c] +- { "a" : b + , c : 'd' , + e : "f" + } +- [] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-errors.json new file mode 100644 index 00000000..6b0786ac --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "A space is required after '['.", + "line": 2, + "column": 1 + }, + { + "message": "A space is required before ']'.", + "line": 2, + "column": 6 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-input.yaml new file mode 100644 index 00000000..b13c841c --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-input.yaml @@ -0,0 +1 @@ +[flow]: block diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-output.yml new file mode 100644 index 00000000..f86e7d9d --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-output.yml @@ -0,0 +1,2 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/LX3P-input.yaml +[ flow ]: block diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-errors.json new file mode 100644 index 00000000..f449986c --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-errors.json @@ -0,0 +1,22 @@ +[ + { + "message": "There should be no space after '['.", + "line": 7, + "column": 4 + }, + { + "message": "There should be no space before ']'.", + "line": 8, + "column": 19 + }, + { + "message": "There should be no space after '['.", + "line": 9, + "column": 4 + }, + { + "message": "There should be no space before ']'.", + "line": 10, + "column": 15 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-input.yaml new file mode 100644 index 00000000..9123ce21 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-input.yaml @@ -0,0 +1,9 @@ +? - Detroit Tigers + - Chicago cubs +: + - 2001-07-23 + +? [ New York Yankees, + Atlanta Braves ] +: [ 2001-07-02, 2001-08-12, + 2001-08-14 ] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-output.yml new file mode 100644 index 00000000..d61a8810 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-output.yml @@ -0,0 +1,10 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/M5DY-input.yaml +? - Detroit Tigers + - Chicago cubs +: + - 2001-07-23 + +? [New York Yankees, + Atlanta Braves] +: [2001-07-02, 2001-08-12, + 2001-08-14] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-errors.json new file mode 100644 index 00000000..d891532a --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '['.", + "line": 2, + "column": 4 + }, + { + "message": "There should be no space before ']'.", + "line": 2, + "column": 9 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml new file mode 100644 index 00000000..f709dc84 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml @@ -0,0 +1,5 @@ +- [ a, b ] +- { a: b } +- "a" +- 'b' +- c diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-output.yml new file mode 100644 index 00000000..b17af5b3 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-output.yml @@ -0,0 +1,6 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/Q88A-input.yaml +- [a, b] +- { a: b } +- "a" +- 'b' +- c diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-errors.json new file mode 100644 index 00000000..8a540bf2 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-errors.json @@ -0,0 +1,12 @@ +[ + { + "message": "There should be no space after '['.", + "line": 2, + "column": 12 + }, + { + "message": "There should be no space before ']'.", + "line": 2, + "column": 22 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml new file mode 100644 index 00000000..df338477 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml @@ -0,0 +1,2 @@ +sequence: [ one, two, ] +mapping: { sky: blue, sea: green } diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-output.yml new file mode 100644 index 00000000..7488db9f --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-output.yml @@ -0,0 +1,3 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/UDR7-input.yaml +sequence: [one, two,] +mapping: { sky: blue, sea: green } diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-errors.json new file mode 100644 index 00000000..10527703 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "There should be no space before ']'.", + "line": 2, + "column": 25 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-input.yaml new file mode 100644 index 00000000..cdd77706 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-input.yaml @@ -0,0 +1,3 @@ +- [name , hr, avg ] +- [Mark McGwire, 65, 0.278] +- [Sammy Sosa , 63, 0.288] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-output.yml new file mode 100644 index 00000000..546ed2be --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-output.yml @@ -0,0 +1,4 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/YD5X-input.yaml +- [name , hr, avg] +- [Mark McGwire, 65, 0.278] +- [Sammy Sosa , 63, 0.288] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/_config.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/_config.json new file mode 100644 index 00000000..f8bb9340 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never-with-object-option/_config.json @@ -0,0 +1,15 @@ +{ + "options": [ + "never", + { + "singleValue": true, + "objectsInArrays": true, + "arraysInArrays": true + } + ], + "settings": { + "yml": { + "indent": 8 + } + } +} diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-errors.json b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-errors.json new file mode 100644 index 00000000..7d1253c2 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "There should be no space after '['.", + "line": 9, + "column": 15 + } +] diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-input.yaml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-input.yaml new file mode 100644 index 00000000..b5496c11 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-input.yaml @@ -0,0 +1,12 @@ + # Leading comment line spaces are + # neither content nor indentation. + +Not indented: + By one space: | + By four + spaces + Flow style: [ # Leading spaces + By two, # in flow style + Also by two, # are neither + Still by two # content nor + ] # indentation. diff --git a/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-output.yml b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-output.yml new file mode 100644 index 00000000..779be8f2 --- /dev/null +++ b/tests/fixtures/rules/flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-output.yml @@ -0,0 +1,12 @@ +# flow-sequence-bracket-spacing/invalid/yaml-test-suite-for-never/6HB6-input.yaml + # Leading comment line spaces are + # neither content nor indentation. + +Not indented: + By one space: | + By four + spaces + Flow style: [By two, # in flow style + Also by two, # are neither + Still by two # content nor + ] # indentation. diff --git a/tools/update-fixtures.ts b/tools/update-fixtures.ts index f22eefae..9422df12 100644 --- a/tools/update-fixtures.ts +++ b/tools/update-fixtures.ts @@ -55,6 +55,14 @@ makeSuiteTests( default: [], never: ["never"], always: ["always"], + "never-with-object-option": [ + "never", + { arraysInObjects: true, objectsInObjects: true }, + ], + "always-with-object-option": [ + "always", + { arraysInObjects: true, objectsInObjects: true }, + ], }, { force: true }, ); @@ -75,6 +83,14 @@ makeSuiteTests( default: [], never: ["never"], always: ["always"], + "never-with-object-option": [ + "never", + { singleValue: true, objectsInArrays: true, arraysInArrays: true }, + ], + "always-with-object-option": [ + "always", + { singleValue: true, objectsInArrays: true, arraysInArrays: true }, + ], }, { force: true }, );