fix(v2): improve stylelint copyright header rule (#2363)

* fix(v2): improve stylelint copyright header rule

* Whitelist stylelint-copyright from Jest
This commit is contained in:
Yangshun Tay 2020-03-07 11:49:52 +08:00 committed by GitHub
parent 03791ce694
commit 6cc0aa2e75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 113 additions and 81 deletions

View file

@ -0,0 +1,58 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const testRule = require('stylelint-test-rule-tape');
const stylelintCopyright = require('..');
testRule(stylelintCopyright.rule, {
ruleName: stylelintCopyright.ruleName,
accept: [
{
code: `
/**
* Copyright
*/
.foo {}`,
},
{
code: `
/**
* copyright
*/
.foo {}`,
},
],
reject: [
{
code: `
/**
* Copyleft
*/
.foo {}`,
message: `Missing copyright in the header comment (${stylelintCopyright.ruleName})`,
line: 2,
column: 1,
},
{
code: `
/**
* Copyleft
*/
/**
* Copyright
*/
.foo {}`,
message: `Missing copyright in the header comment (${stylelintCopyright.ruleName})`,
line: 2,
column: 1,
},
],
});