validate-element-name
Advanced tools
Comparing version 0.1.1 to 0.2.0
10
index.js
@@ -24,2 +24,10 @@ 'use strict'; | ||
if (/^polymer-/.test(name)) { | ||
throw new Error('Custom element names should not start with `polymer-`.\nSee: http://webcomponents.github.io/articles/how-should-i-name-my-element'); | ||
} | ||
if (/^x-/.test(name)) { | ||
throw new Error('Custom element names should not start with `x-`.\nSee: http://webcomponents.github.io/articles/how-should-i-name-my-element/'); | ||
} | ||
if (/^\d/i.test(name)) { | ||
@@ -39,3 +47,3 @@ throw new Error('Custom element names must not start with a digit'); | ||
if (reservedNames.indexOf(name) !== -1) { | ||
throw new Error('The supplied element name is reserved and can\'t be used. See: http://www.w3.org/TR/custom-elements/#concepts'); | ||
throw new Error('The supplied element name is reserved and can\'t be used.\nSee: http://www.w3.org/TR/custom-elements/#concepts'); | ||
} | ||
@@ -42,0 +50,0 @@ |
{ | ||
"name": "validate-element-name", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Validate the name of a custom element", | ||
"license": "MIT", | ||
"repository": "sindresorhus/validate-element-name", | ||
"bin": { | ||
"validate-element-name": "cli.js" | ||
}, | ||
"author": { | ||
@@ -19,5 +22,9 @@ "name": "Sindre Sorhus", | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"cli.js" | ||
], | ||
"keywords": [ | ||
"cli", | ||
"bin", | ||
"app", | ||
"validate", | ||
@@ -24,0 +31,0 @@ "validator", |
@@ -5,3 +5,4 @@ # validate-element-name [![Build Status](https://travis-ci.org/sindresorhus/validate-element-name.svg?branch=master)](https://travis-ci.org/sindresorhus/validate-element-name) | ||
Custom element names should start with `a-z` and contain `a-z` and at least one `-` with optionally `0-9`. | ||
Custom element names should start with `a-z` and contain `a-z` and at least one `-` with optionally `0-9`. | ||
[You should not use the `x-` or `polymer-` prefix](http://webcomponents.github.io/articles/how-should-i-name-my-element/). | ||
@@ -32,4 +33,26 @@ | ||
## CLI | ||
You can also use it as a CLI app by installing it globally: | ||
```bash | ||
$ npm install --global validate-element-name | ||
``` | ||
#### Usage | ||
```bash | ||
$ validate-element-name --help | ||
Usage | ||
$ validate-element-name <element-name> | ||
Example | ||
$ validate-element-name s-slider | ||
Valid element name 👍 | ||
``` | ||
## License | ||
[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4219
4
69
57