prettier-plugin-noshift.js 0.0.0 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 [otoneko.]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 [otoneko.]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README-ja.md ADDED
@@ -0,0 +1,114 @@
1
+ [![npm](https://img.shields.io/npm/v/prettier-plugin-noshift.js)](https://www.npmjs.com/package/prettier-plugin-noshift.js) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
2
+
3
+ # prettier-plugin-noshift.js
4
+
5
+ <div align="center">
6
+ <img src="https://raw.githubusercontent.com/otoneko1102/NoShift.js/refs/heads/main/icon.png" alt="noshift.js" width="128" height="128">
7
+ </div>
8
+
9
+ <div align="center">
10
+
11
+ [English](./README.md) | **日本語**
12
+
13
+ </div>
14
+
15
+ > [NoShift.js](https://github.com/otoneko1102/NoShift.js) (`.nsjs`) ファイルをフォーマットする [Prettier](https://prettier.io/) プラグイン
16
+
17
+ [Prettier](https://prettier.io/) はコードフォーマッターです。このプラグインは、Shift キーを押さずに JavaScript を書ける Joke 言語 [NoShift.js](https://github.com/otoneko1102/NoShift.js) の `.nsjs` ファイルに対応します。
18
+
19
+ ---
20
+
21
+ ## インストール
22
+
23
+ ```bash
24
+ npm install --save-dev prettier prettier-plugin-noshift.js
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 使い方
30
+
31
+ `.prettierrc` にプラグインを追加します:
32
+
33
+ ```json
34
+ {
35
+ "plugins": ["prettier-plugin-noshift.js"]
36
+ }
37
+ ```
38
+
39
+ `.nsjs` ファイルをフォーマット:
40
+
41
+ ```bash
42
+ npx prettier --write "**/*.nsjs"
43
+ ```
44
+
45
+ > **ヒント:** `nsc create` でプロジェクトを作成すると、Prettier とこのプラグインが自動的にインストール・設定されます。
46
+
47
+ ---
48
+
49
+ ## 仕組み
50
+
51
+ プラグインは3段階のパイプラインでフォーマットします:
52
+
53
+ 1. **`.nsjs` → JavaScript** — NoShift.js 構文を JavaScript に変換
54
+ 2. **JavaScript → フォーマット済み JavaScript** — Prettier の組み込み babel パーサーでフォーマット
55
+ 3. **フォーマット済み JavaScript → `.nsjs`** — NoShift.js 構文に逆変換
56
+
57
+ 標準の Prettier オプションはすべてステージ 2 に転送されるため、既存の設定(`semi`、`singleQuote`、`tabWidth` など)がそのまま適用されます。
58
+
59
+ ---
60
+
61
+ ## 例
62
+
63
+ **フォーマット前** (`src/index.nsjs`):
64
+
65
+ ```text
66
+ const x = 1 ;
67
+ function greet^8name^9 ^[
68
+ const msg=^2^3hello, ^2^;name;
69
+ console.log^8msg^9 ;
70
+ return msg ;
71
+ ^]
72
+ ```
73
+
74
+ **フォーマット後** `npx prettier --write`:
75
+
76
+ ```text
77
+ const x ^- 1;
78
+ function greet^8name^9 ^[
79
+ const msg ^- ^2^3hello, ^2 ^; name;
80
+ console.log^8msg^9;
81
+ return msg;
82
+ ^]
83
+ ```
84
+
85
+ ---
86
+
87
+ ## 対応オプション
88
+
89
+ すべての標準 Prettier オプションがサポートされています。主なもの:
90
+
91
+ | オプション | デフォルト | 説明 |
92
+ |---|---|---|
93
+ | `semi` | `true` | 文末にセミコロンを付ける |
94
+ | `singleQuote` | `false` | シングルクォートを使う |
95
+ | `tabWidth` | `2` | インデント幅 |
96
+ | `trailingComma` | `"all"` | 末尾カンマ |
97
+ | `printWidth` | `80` | 1行の最大文字数 |
98
+ | `bracketSpacing` | `true` | オブジェクト括弧内のスペース |
99
+ | `arrowParens` | `"always"` | アロー関数の括弧 |
100
+ | `endOfLine` | `"lf"` | 改行スタイル |
101
+
102
+ ---
103
+
104
+ ## 関連
105
+
106
+ - [noshift.js](https://www.npmjs.com/package/noshift.js) — NoShift.js コンパイラ CLI
107
+ - [NoShift.js VS Code 拡張機能](https://marketplace.visualstudio.com/items?itemName=otoneko1102.noshift-vscode) — シンタックスハイライトとスニペット
108
+ - [ドキュメント](https://noshift.js.org/)
109
+
110
+ ---
111
+
112
+ ## ライセンス
113
+
114
+ [MIT](./LICENSE) © [otoneko.](https://github.com/otoneko1102)
package/README.md ADDED
@@ -0,0 +1,114 @@
1
+ [![npm](https://img.shields.io/npm/v/prettier-plugin-noshift.js)](https://www.npmjs.com/package/prettier-plugin-noshift.js) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
2
+
3
+ # prettier-plugin-noshift.js
4
+
5
+ <div align="center">
6
+ <img src="https://raw.githubusercontent.com/otoneko1102/NoShift.js/refs/heads/main/icon.png" alt="noshift.js" width="128" height="128">
7
+ </div>
8
+
9
+ <div align="center">
10
+
11
+ **English** | [日本語](./README-ja.md)
12
+
13
+ </div>
14
+
15
+ > A [Prettier](https://prettier.io/) plugin for formatting [NoShift.js](https://github.com/otoneko1102/NoShift.js) (`.nsjs`) files.
16
+
17
+ [Prettier](https://prettier.io/) is an opinionated code formatter. This plugin adds support for `.nsjs` files — the [NoShift.js](https://github.com/otoneko1102/NoShift.js) joke language that lets you write JavaScript without pressing the Shift key.
18
+
19
+ ---
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ npm install --save-dev prettier prettier-plugin-noshift.js
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Usage
30
+
31
+ Add the plugin to your `.prettierrc`:
32
+
33
+ ```json
34
+ {
35
+ "plugins": ["prettier-plugin-noshift.js"]
36
+ }
37
+ ```
38
+
39
+ Then format your `.nsjs` files:
40
+
41
+ ```bash
42
+ npx prettier --write "**/*.nsjs"
43
+ ```
44
+
45
+ > **Tip:** If you scaffold a project with `nsc create`, Prettier and this plugin are automatically installed and configured.
46
+
47
+ ---
48
+
49
+ ## How It Works
50
+
51
+ The plugin uses a three-stage pipeline:
52
+
53
+ 1. **`.nsjs` → JavaScript** — convert NoShift.js syntax to standard JS
54
+ 2. **JavaScript → formatted JavaScript** — format with Prettier's built-in babel parser
55
+ 3. **formatted JavaScript → `.nsjs`** — convert back to NoShift.js syntax
56
+
57
+ All standard Prettier formatting options are forwarded to stage 2, so your existing config (`semi`, `singleQuote`, `tabWidth`, etc.) just works.
58
+
59
+ ---
60
+
61
+ ## Example
62
+
63
+ **Before** (`src/index.nsjs`):
64
+
65
+ ```text
66
+ const x = 1 ;
67
+ function greet^8name^9 ^[
68
+ const msg=^2^3hello, ^2^;name;
69
+ console.log^8msg^9 ;
70
+ return msg ;
71
+ ^]
72
+ ```
73
+
74
+ **After** `npx prettier --write`:
75
+
76
+ ```text
77
+ const x ^- 1;
78
+ function greet^8name^9 ^[
79
+ const msg ^- ^2^3hello, ^2 ^; name;
80
+ console.log^8msg^9;
81
+ return msg;
82
+ ^]
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Supported Options
88
+
89
+ All standard Prettier options are supported. Common ones:
90
+
91
+ | Option | Default | Description |
92
+ |---|---|---|
93
+ | `semi` | `true` | Add semicolons at the end of statements |
94
+ | `singleQuote` | `false` | Use single quotes instead of double quotes |
95
+ | `tabWidth` | `2` | Indentation width |
96
+ | `trailingComma` | `"all"` | Trailing commas |
97
+ | `printWidth` | `80` | Max line width |
98
+ | `bracketSpacing` | `true` | Spaces inside object braces |
99
+ | `arrowParens` | `"always"` | Arrow function parentheses |
100
+ | `endOfLine` | `"lf"` | Line ending style |
101
+
102
+ ---
103
+
104
+ ## Related
105
+
106
+ - [noshift.js](https://www.npmjs.com/package/noshift.js) — The NoShift.js compiler CLI
107
+ - [NoShift.js VS Code Extension](https://marketplace.visualstudio.com/items?itemName=otoneko1102.noshift-vscode) — Syntax highlighting & snippets
108
+ - [Documentation](https://noshift.js.org/)
109
+
110
+ ---
111
+
112
+ ## License
113
+
114
+ [MIT](./LICENSE) © [otoneko.](https://github.com/otoneko1102)
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "prettier-plugin-noshift.js",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "description": "Prettier plugin for NoShift.js",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js"
9
9
  },
10
- "files": [
11
- "src/"
12
- ],
13
10
  "scripts": {
14
11
  "test": "node test/test.js"
15
12
  },
@@ -32,7 +29,7 @@
32
29
  "bugs": {
33
30
  "url": "https://github.com/otoneko1102/NoShift.js/issues"
34
31
  },
35
- "homepage": "https://github.com/otoneko1102/NoShift.js#readme",
32
+ "homepage": "https://noshift.js.org",
36
33
  "peerDependencies": {
37
34
  "prettier": "^3.8.1"
38
35
  }