|
| 1 | +/** |
| 2 | + * @fileoverview flat configs test |
| 3 | + |
| 4 | + */ |
| 5 | + |
| 6 | +'use strict' |
| 7 | + |
| 8 | +const plugin = require('../../../lib/index') |
| 9 | +const assert = require('assert/strict') |
| 10 | + |
| 11 | +describe('flat configs', () => { |
| 12 | + it('should export base config', () => { |
| 13 | + const base = plugin.configs['flat/base'] |
| 14 | + assert.ok(base) |
| 15 | + assert.equal(typeof base, 'object') |
| 16 | + assert.strictEqual(base.plugins.vue, plugin) |
| 17 | + assert.strictEqual(base.rules['vue/comment-directive'], 'error') |
| 18 | + }) |
| 19 | + it('should export essential config', () => { |
| 20 | + const essential = plugin.configs['flat/essential'] |
| 21 | + assert.ok(essential) |
| 22 | + assert.equal(typeof essential, 'object') |
| 23 | + assert.strictEqual(essential.plugins.vue, plugin) |
| 24 | + assert.strictEqual(essential.rules['vue/comment-directive'], 'error') |
| 25 | + assert.strictEqual( |
| 26 | + essential.rules['vue/multi-word-component-names'], |
| 27 | + 'error' |
| 28 | + ) |
| 29 | + }) |
| 30 | + |
| 31 | + it('should export strongly-recommended config', () => { |
| 32 | + const stronglyRecommended = plugin.configs['flat/vue2-strongly-recommended'] |
| 33 | + assert.ok(stronglyRecommended) |
| 34 | + assert.equal(typeof stronglyRecommended, 'object') |
| 35 | + assert.strictEqual(stronglyRecommended.plugins.vue, plugin) |
| 36 | + assert.strictEqual( |
| 37 | + stronglyRecommended.rules['vue/comment-directive'], |
| 38 | + 'error' |
| 39 | + ) |
| 40 | + assert.strictEqual( |
| 41 | + stronglyRecommended.rules['vue/multi-word-component-names'], |
| 42 | + 'error' |
| 43 | + ) |
| 44 | + }) |
| 45 | + |
| 46 | + it('should export recommended config', () => { |
| 47 | + const recommended = plugin.configs['flat/recommended'] |
| 48 | + assert.ok(recommended) |
| 49 | + assert.equal(typeof recommended, 'object') |
| 50 | + assert.strictEqual(recommended.plugins.vue, plugin) |
| 51 | + assert.strictEqual(recommended.rules['vue/comment-directive'], 'error') |
| 52 | + assert.strictEqual( |
| 53 | + recommended.rules['vue/multi-word-component-names'], |
| 54 | + 'error' |
| 55 | + ) |
| 56 | + assert.strictEqual(recommended.rules['vue/attributes-order'], 'warn') |
| 57 | + }) |
| 58 | + |
| 59 | + it('should export vue2-essential config', () => { |
| 60 | + const essential = plugin.configs['flat/vue2-essential'] |
| 61 | + assert.ok(essential) |
| 62 | + assert.equal(typeof essential, 'object') |
| 63 | + assert.strictEqual(essential.plugins.vue, plugin) |
| 64 | + assert.strictEqual(essential.rules['vue/comment-directive'], 'error') |
| 65 | + assert.strictEqual( |
| 66 | + essential.rules['vue/multi-word-component-names'], |
| 67 | + 'error' |
| 68 | + ) |
| 69 | + }) |
| 70 | + |
| 71 | + it('should export vue2-strongly-recommended config', () => { |
| 72 | + const stronglyRecommended = plugin.configs['flat/vue2-strongly-recommended'] |
| 73 | + assert.ok(stronglyRecommended) |
| 74 | + assert.equal(typeof stronglyRecommended, 'object') |
| 75 | + assert.strictEqual(stronglyRecommended.plugins.vue, plugin) |
| 76 | + assert.strictEqual( |
| 77 | + stronglyRecommended.rules['vue/comment-directive'], |
| 78 | + 'error' |
| 79 | + ) |
| 80 | + assert.strictEqual( |
| 81 | + stronglyRecommended.rules['vue/multi-word-component-names'], |
| 82 | + 'error' |
| 83 | + ) |
| 84 | + }) |
| 85 | + |
| 86 | + it('should export vue2-recommended config', () => { |
| 87 | + const recommended = plugin.configs['flat/vue2-recommended'] |
| 88 | + assert.ok(recommended) |
| 89 | + assert.equal(typeof recommended, 'object') |
| 90 | + assert.strictEqual(recommended.plugins.vue, plugin) |
| 91 | + assert.strictEqual(recommended.rules['vue/comment-directive'], 'error') |
| 92 | + assert.strictEqual( |
| 93 | + recommended.rules['vue/multi-word-component-names'], |
| 94 | + 'error' |
| 95 | + ) |
| 96 | + assert.strictEqual(recommended.rules['vue/attributes-order'], 'warn') |
| 97 | + }) |
| 98 | +}) |
0 commit comments