// ----------------------------------------------------------------------------- // Requirements // ----------------------------------------------------------------------------- import { RuleTester } from 'eslint'; import rule from './../../../src/rules/jsx-closing-bracket-location'; const parserOptions = { ecmaVersion: 2018, ecmaFeatures: { jsx: true, }, }; const MESSAGE_ON_THE_NEXT_LINE = 'The closing bracket must be placed on the next line'; const MESSAGE_RIGHT_AFTER_PROP = 'The closing bracket must be placed right after the last prop'; // ----------------------------------------------------------------------------- // Tests // ----------------------------------------------------------------------------- const ruleTester = new RuleTester({parserOptions}); ruleTester.run('react-props-brackets', rule, { valid: [ '', '', '', '', '', '', { code: [ '', ].join('\n'), }, { code: [ '', ].join('\n'), }, { code: [ '', ].join('\n'), }, { code: [ '', ].join('\n'), }, ], invalid: [ { code: [ '', ].join('\n'), errors: [{ message: MESSAGE_RIGHT_AFTER_PROP, line: 1, column: 11, endLine: 2, endColumn: 2, }], }, { code: [ '', ].join('\n'), errors: [{ message: MESSAGE_RIGHT_AFTER_PROP, line: 1, column: 11, endLine: 2, endColumn: 3, }], }, { code: [ '', ].join('\n'), errors: [{ message: MESSAGE_RIGHT_AFTER_PROP, line: 1, column: 26, endLine: 2, endColumn: 2, }], }, { code: [ '', ].join('\n'), errors: [{ message: MESSAGE_RIGHT_AFTER_PROP, line: 1, column: 26, endLine: 2, endColumn: 3, }], }, { code: [ '', ].join('\n'), errors: [{ message: MESSAGE_RIGHT_AFTER_PROP, line: 3, column: 3, endLine: 4, endColumn: 3, }], }, { code: [ '', ].join('\n'), errors: [{ message: MESSAGE_ON_THE_NEXT_LINE, line: 4, column: 7, endLine: 4, endColumn: 9, }], }, { code: [ '', ].join('\n'), errors: [{ message: MESSAGE_RIGHT_AFTER_PROP, line: 3, column: 3, endLine: 4, endColumn: 2, }], }, { code: [ '', ].join('\n'), errors: [{ message: MESSAGE_ON_THE_NEXT_LINE, line: 4, column: 7, endLine: 4, endColumn: 8, }], }, ], });