Pureline

Pureline JavaScript

const-first, semicolons, braces, async/await.

Pureline JavaScript is explicit where the language permits sloppiness: blocks always with braces, semicolons always, `const` as the default, and linear control flow through async/await.

const-firstSemicolonsBracesasync/await
7Profile rules
16automated
Check JavaScript code

Profile rules

PL-JS-001 Checker

Braces Are Mandatory

Every control-flow body gets a block, even for a single statement.

Avoid
if (!user) return;
while (queue.length) process(queue.shift());
Pureline
if (!user) {
    return;
}
PL-JS-002 Checker

Use Semicolons

Pureline JavaScript uses semicolons consistently and does not rely on automatic semicolon insertion.

Avoid
const session = createSession(user)
session.start()
ASI trap
const total = base + tax
[fee, tip].forEach(add)
Pureline
const session = createSession(user);
session.start();
PL-JS-003 Checker

`const` First

const is the default. Use let only for actual reassignment. Do not use var.

Avoid
var user = loadUser();
let without reassignment
let session = createSession(user);
session.start();
Pureline
const user = loadUser();
Actual reassignment
let count = 0;
count++;
PL-JS-004 Checker

Prefer `async` / `await`

Avoid promise chains when async/await produces clearer control flow.

Avoid
function loadUser(id) {
    return fetch(`/users/${id}`)
        .then(response => response.ok ? response.json() : null);
}
Pureline
async function loadUser(id) {
    const response = await fetch(`/users/${id}`);

    if (!response.ok) {
        return null;
    }

    return response.json();
}
PL-JS-005 Checker

Arrow Functions Are Contextual

Normal named logic may use regular functions. Arrow functions are well suited for local callbacks, but are not the default for everything.

Avoid
Arrow functions as the default for everything
const createSession = (user) => {
    const session = new Session(user);
    session.start();
    return session;
};
Pureline
function createSession(user) {
    return new Session(user);
}
Local callback
users.filter(user => user.active());
PL-JS-006 Checker

Destructuring Must Improve Clarity

Destructuring is good when it shows intent. Large objects are not destructured merely because the language allows it.

Avoid
const { id, name, email, role, createdAt, updatedAt, settings: { theme, locale } } = user;
Pureline
const { id, name } = user;
PL-JS-007

Folder Density

A JavaScript feature/source folder may contain at most **10 production source modules** by default.

Barrel files such as index.js, tests, generated files, and metadata-only files do not count.

If the folder exceeds the limit, split it by responsibility rather than by arbitrary file count.

Pureline
Split by responsibility
session/
    index.js
    state/
    transport/
    storage/

Core rules in the JavaScript checker

In addition to the profile rules, the JavaScript checker verifies these rules from the Pureline Core: