Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: intlify/eslint-plugin-vue-i18n
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.0-next.8
Choose a base ref
...
head repository: intlify/eslint-plugin-vue-i18n
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.0-next.9
Choose a head ref
  • 7 commits
  • 12 files changed
  • 5 contributors

Commits on Apr 2, 2024

  1. chore: use vitepress v1 & fix vitepress config (#491)

    * chore: fix vitepress config
    
    * use vitepress v1
    ota-meshi authored Apr 2, 2024

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Zylphrex Tony Xiao
    Copy the full SHA
    5b584a4 View commit details
  2. chore: fix dev deps

    ota-meshi committed Apr 2, 2024
    Copy the full SHA
    86ad94f View commit details
  3. chore: fix dev deps

    ota-meshi committed Apr 2, 2024
    Copy the full SHA
    cd37bfa View commit details
  4. chore(deps): update pnpm to v8.15.6

    renovate[bot] committed Apr 2, 2024
    Copy the full SHA
    4cd57e2 View commit details

Commits on Apr 3, 2024

  1. feat: add lowercase to key-format-style rule (#492)

    oikalyptus authored Apr 3, 2024
    Copy the full SHA
    30ad848 View commit details
  2. chore: fix doc

    ota-meshi committed Apr 3, 2024
    Copy the full SHA
    95d74a6 View commit details
  3. chore: release @intlify/eslint-plugin-vue-i18n (next) (#493)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Apr 3, 2024
    Copy the full SHA
    6a2131c View commit details
5 changes: 5 additions & 0 deletions .changeset/modern-apricots-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@intlify/eslint-plugin-vue-i18n': minor
---

add lowercase option to key-format-style rule
1 change: 1 addition & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
"forty-tools-dream",
"fresh-squids-build",
"khaki-eyes-serve",
"modern-apricots-flash",
"ninety-snakes-scream",
"olive-chairs-invent",
"pink-hairs-fail",
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ module.exports = {
},
overrides: [
{
files: ['*.ts'],
files: ['*.ts', '*.mts'],
extends: ['plugin:@typescript-eslint/recommended'],
parser: 'vue-eslint-parser',
parserOptions: {
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @intlify/eslint-plugin-vue-i18n

## 3.0.0-next.9

### Minor Changes

- [#492](https://github.com/intlify/eslint-plugin-vue-i18n/pull/492) [`30ad848`](https://github.com/intlify/eslint-plugin-vue-i18n/commit/30ad84859d21d12b9882c3d03dd411360e804bea) Thanks [@oikalyptus](https://github.com/oikalyptus)! - add lowercase option to key-format-style rule

## 3.0.0-next.8

### Minor Changes
70 changes: 70 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { defineConfig } from 'vitepress'
import { getRulesWithCategories } from '../../scripts/lib/rules'
import '../../scripts/update-rule-docs'
import '../../scripts/update-index-docs'

// https://vitepress.dev/reference/site-config
export default async () => {
const rules = await getRulesWithCategories()
return defineConfig({
base: '/',
title: 'eslint-plugin-vue-i18n',
description: 'ESLint plugin for Vue I18n',
head: [['meta', { name: 'theme-color', content: '#3eaf7c' }]],
lastUpdated: true,
themeConfig: {
editLink: {
pattern:
'https://github.com/intlify/eslint-plugin-vue-i18n/edit/master/docs/:path',
text: 'Edit this page on GitHub'
},
nav: [
{
text: 'Support Intlify',
items: [
{
text: 'GitHub Sponsors',
link: 'https://github.com/sponsors/kazupon'
},
{
text: 'Patreon',
link: 'https://www.patreon.com/kazupon'
}
]
},
{
text: 'Release Notes',
link: 'https://github.com/intlify/eslint-plugin-vue-i18n/releases'
}
],
sidebar: [
{
text: 'Introduction',
link: '/intro'
},
{
text: 'Getting Started',
link: '/started'
},
{
text: 'Available Rules',
link: '/rules/'
},
...rules.map(({ category, rules }) => ({
text: `Rules in ${category}`,
collapsed: false,
items: rules.map(rule => ({
text: rule.name,
link: `/rules/${rule.name}`
}))
}))
],
socialLinks: [
{
icon: 'github',
link: 'https://github.com/intlify/eslint-plugin-vue-i18n'
}
]
}
})
}
67 changes: 0 additions & 67 deletions docs/.vitepress/config.ts

This file was deleted.

31 changes: 30 additions & 1 deletion docs/rules/key-format-style.md
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ This rule aims to enforces specific casing for localization key names.
```yaml
camelCaseKey: The key for this value is camel case.
kebab-case-key: The key for this value is kebab case.
lowercase: The key for this value is lower case.
snake_case_key: The key for this value is snake case.
mixed_Case-key: Perhaps you don't want to use this casing.
```
@@ -47,7 +48,7 @@ Also, the following localization key definitions are reported as errors, because
{
"@intlify/vue-i18n/key-format-style": [
"error",
"camelCase" | "kebab-case" | "snake_case",
"camelCase" | "kebab-case" | "lowercase" | "snake_case",
{
"allowArray": false,
"splitByDots": false
@@ -114,6 +115,34 @@ app_title: I18N Management System
</eslint-code-block>
:+1: Examples of **correct** code for this rule with `"lowercase"`:
<eslint-code-block language="yaml">
```yaml
# eslint @intlify/vue-i18n/key-format-style: ['error', 'lowercase']

# ✓ GOOD
apptitle: I18N Management System
```
</eslint-code-block>
:-1: Examples of **incorrect** code for this rule with `"lowercase"`:
<eslint-code-block language="yaml">
```yaml
# eslint @intlify/vue-i18n/key-format-style: ['error', 'lowercase']

# ✗ BAD
appTitle: I18N Management System
app_title: I18N Management System
APP_TITLE: I18N Management System
```
</eslint-code-block>
:+1: Examples of **correct** code for this rule with `"snake_case"`:
<eslint-code-block language="yaml">
1 change: 1 addition & 0 deletions lib/rules/key-format-style.ts
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ const debug = debugBuilder('eslint-plugin-vue-i18n:key-format-style')
const allowedCaseOptions = [
'camelCase',
'kebab-case',
'lowercase',
'snake_case',
'SCREAMING_SNAKE_CASE'
] as const
16 changes: 16 additions & 0 deletions lib/utils/casing.ts
Original file line number Diff line number Diff line change
@@ -75,6 +75,20 @@ export function isCamelCase(str: string): boolean {
return true
}

/**
* Checks whether the given string is lowercase.
*/
export function isLowerCase(str: string): boolean {
if (
hasSymbols(str) ||
hasUpper(str) ||
/-|_|\s/u.exec(str) // kebab or snake or space
) {
return false
}
return true
}

/**
* Checks whether the given string is PascalCase.
*/
@@ -104,6 +118,7 @@ const checkersMap = {
'kebab-case': isKebabCase,
snake_case: isSnakeCase,
camelCase: isCamelCase,
lowercase: isLowerCase,
PascalCase: isPascalCase,
SCREAMING_SNAKE_CASE: isScreamingSnakeCase
}
@@ -127,6 +142,7 @@ export function pascalCase(str: string): string {
export const allowedCaseOptions = [
'camelCase',
'kebab-case',
'lowercase',
'PascalCase',
'snake_case',
'SCREAMING_SNAKE_CASE'
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@intlify/eslint-plugin-vue-i18n",
"description": "ESLint plugin for Vue I18n",
"version": "3.0.0-next.8",
"version": "3.0.0-next.9",
"license": "MIT",
"homepage": "https://github.com/intlify/eslint-plugin-vue-i18n#readme",
"keywords": [
@@ -29,7 +29,7 @@
"engines": {
"node": ">=16.0.0"
},
"packageManager": "pnpm@8.15.5",
"packageManager": "pnpm@8.15.6",
"type": "commonjs",
"files": [
"dist"
@@ -115,7 +115,7 @@
"path-scurry": "^1.10.1",
"prettier": "^2.8.8",
"typescript": "^5.1.6",
"vitepress": "1.0.0-beta.7",
"vitepress": "^1.0.2",
"vue-eslint-editor": "^1.1.0",
"vue-github-button": "^3.1.0"
},
Loading