Skip to content

Replace words #1214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/rules/no-bare-strings-in-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ If you want to report these string literals, enable the [vue/no-useless-v-bind]
```js
{
"vue/no-bare-strings-in-template": ["error", {
"whitelist": [
"allowlist": [
"(", ")", ",", ".", "&", "+", "-", "=", "*", "/", "#", "%", "!", "?", ":", "[", "]", "{", "}", "<", ">", "\u00b7", "\u2022", "\u2010", "\u2013", "\u2014", "\u2212", "|"
],
"attributes": {
Expand All @@ -70,7 +70,7 @@ If you want to report these string literals, enable the [vue/no-useless-v-bind]
}
```

- `whitelist` ... An array of whitelisted strings.
- `allowlist` ... An array of allowed strings.
- `attributes` ... An object whose keys are tag name or patterns and value is an array of attributes to check for that tag name.
- `directives` ... An array of directive names to check literal value.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/require-prop-type-constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ description: require prop type to be a constructor

This rule reports prop types that can't be presumed as constructors.

It's impossible to catch every possible case and know whether the prop type is a constructor or not, hence this rule black list few types of nodes, instead of white-listing correct ones.
It's impossible to catch every possible case and know whether the prop type is a constructor or not, hence this rule block-list few types of nodes, instead of allow-listing correct ones.

The following types are forbidden and will be reported:

Expand Down
10 changes: 5 additions & 5 deletions lib/rules/no-bare-strings-in-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ module.exports = {
{
type: 'object',
properties: {
whitelist: {
allowlist: {
type: 'array',
items: { type: 'string' },
uniqueItems: true
Expand Down Expand Up @@ -164,12 +164,12 @@ module.exports = {
*/
const opts = context.options[0] || {}
/** @type {string[]} */
const whitelist = opts.whitelist || DEFAULT_WHITELIST
const allowlist = opts.allowlist || DEFAULT_WHITELIST
const attributes = parseTargetAttrs(opts.attributes || DEFAULT_ATTRIBUTES)
const directives = opts.directives || DEFAULT_DIRECTIVES

const whitelistRe = new RegExp(
whitelist.map((w) => regexp.escape(w)).join('|'),
const allowlistRe = new RegExp(
allowlist.map((w) => regexp.escape(w)).join('|'),
'gu'
)

Expand All @@ -180,7 +180,7 @@ module.exports = {
* @param {string} str
*/
function getBareString(str) {
return str.trim().replace(whitelistRe, '').trim()
return str.trim().replace(allowlistRe, '').trim()
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/no-bare-strings-in-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ tester.run('no-bare-strings-in-template', rule, {
<h1>ipsum</h1>
</template>
`,
options: [{ whitelist: ['Lorem'] }],
options: [{ allowlist: ['Lorem'] }],
errors: [
{
line: 4,
Expand Down