prettier-plugin-noshift.js
v0.1.0
Published
Prettier plugin for NoShift.js
Maintainers
Readme
prettier-plugin-noshift.js
English | 日本語
A Prettier plugin for formatting NoShift.js (
.nsjs) files.
Prettier is an opinionated code formatter. This plugin adds support for .nsjs files — the NoShift.js joke language that lets you write JavaScript without pressing the Shift key.
[!Important]
⚠ Breaking Changes (v0.1.0): Syntax changes in NoShift.js v0.15.0 —^3is now#,^6is now Capitalize,^\is now_. New keyword aliases:or,and,@or,@and.
Install
npm install --save-dev prettier prettier-plugin-noshift.jsUsage
Add the plugin to your .prettierrc:
{
"plugins": ["prettier-plugin-noshift.js"]
}Then format your .nsjs files:
npx prettier --write "**/*.nsjs"Tip: If you scaffold a project with
nsc create, Prettier and this plugin are automatically installed and configured.
How It Works
The plugin uses a three-stage pipeline:
.nsjs→ JavaScript — convert NoShift.js syntax to standard JS- JavaScript → formatted JavaScript — format with Prettier's built-in babel parser
- formatted JavaScript →
.nsjs— convert back to NoShift.js syntax
All standard Prettier formatting options are forwarded to stage 2, so your existing config (semi, singleQuote, tabWidth, etc.) just works.
Example
Before (src/index.nsjs):
const x = 1 ;
function greet^8name^9 ^[
const msg=^2^6hello, ^2^;name;
console.log^8msg^9 ;
return msg ;
^]After npx prettier --write:
const x ^- 1;
function greet^8name^9 ^[
const msg ^- ^2^6hello, ^2 ^; name;
console.log^8msg^9;
return msg;
^]Supported Options
All standard Prettier options are supported. Common ones:
| Option | Default | Description |
|---|---|---|
| semi | true | Add semicolons at the end of statements |
| singleQuote | false | Use single quotes instead of double quotes |
| tabWidth | 2 | Indentation width |
| trailingComma | "all" | Trailing commas |
| printWidth | 80 | Max line width |
| bracketSpacing | true | Spaces inside object braces |
| arrowParens | "always" | Arrow function parentheses |
| endOfLine | "lf" | Line ending style |
Ecosystem / Links
- noshift.js (npm) — The Core Compiler CLI
- @noshift.js/lint (npm) — The Official Linter
- prettier-plugin-noshift.js (npm) — The Official Prettier Plugin
- VS Code Extension — Editor Support (Syntax Highlighting, Snippets)
- Website & Playground
- Repository
