Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Use Node
uses: actions/setup-node@v4
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

name: Test

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Use Node
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org/

- name: Install
run: npm ci

- name: Build
run: npm run build --if-present
Comment thread
TiMESPLiNTER marked this conversation as resolved.

- name: Run tests
run: npm run test --if-present
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ npm install final-decorator
npm install --save-dev eslint-plugin-final
```

## Usage (flat config)
## Usage

### Setting up ESLint

```js
import finalPlugin from 'eslint-plugin-final';
Expand All @@ -30,6 +32,8 @@ export default [
];
```

### Marking classes and methods final

```ts
import { Final } from 'final-decorator';

Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-plugin-final/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-final",
"version": "0.1.1",
"version": "0.1.2",
"description": "ESLint plugin for marking classes and methods as final.",
"author": {
"name": "timesplinter",
Expand All @@ -9,13 +9,13 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/timesplinter/eslint-plugin-final.git",
"url": "git+https://github.com/timesplinter/ts-final.git",
"directory": "packages/eslint-plugin-final"
},
"bugs": {
"url": "https://github.com/timesplinter/eslint-plugin-final/issues"
"url": "https://github.com/timesplinter/ts-final/issues"
},
"homepage": "https://github.com/timesplinter/eslint-plugin-final#readme",
"homepage": "https://github.com/timesplinter/ts-final#readme",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getOwnMethodNames,
hasParserServices,
isFinalDecoratedClass,
} from './noOverrideFinalRuleUtils.js';
} from './finalPluginUtils.js';

const isFinalDecoratorExpression = (expression: any): boolean => {
if (expression?.type === 'Identifier') {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-final/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import finalPlugin from './noOverrideFinalRule.js';
import finalPlugin from './finalPlugin.js';
Comment thread
TiMESPLiNTER marked this conversation as resolved.

export { finalPlugin };
export default finalPlugin;
88 changes: 46 additions & 42 deletions packages/final-decorator/package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
{
"name": "final-decorator",
"version": "0.1.1",
"description": "Runtime TypeScript decorator to mark classes and methods as final.",
"author": {
"name": "timesplinter",
"email": "dev@timesplinter.ch"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/timesplinter/eslint-plugin-final.git",
"directory": "packages/final-decorator"
},
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"default": "./dist/esm/index.js"
"name": "final-decorator",
"version": "0.1.2",
"description": "Runtime TypeScript decorator to mark classes and methods as final.",
"author": {
"name": "timesplinter",
"email": "dev@timesplinter.ch"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/timesplinter/ts-final.git",
"directory": "packages/final-decorator"
},
"bugs": {
"url": "https://github.com/timesplinter/ts-final/issues"
},
"homepage": "https://github.com/timesplinter/ts-final#readme",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"default": "./dist/esm/index.js"
}
},
"files": [
"dist",
"README.md",
"LICENSE"
],
"scripts": {
"build": "rm -rf dist && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",
"prepack": "npm run build",
"test": "echo \"No tests configured\""
},
"keywords": [
"typescript",
"decorator",
"final",
"sealed"
],
"devDependencies": {
"typescript": "^5.0.0"
}
},
"files": [
"dist",
"README.md",
"LICENSE"
],
"scripts": {
"build": "rm -rf dist && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",
"prepack": "npm run build",
"test": "echo \"No tests configured\""
},
"keywords": [
"typescript",
"decorator",
"final",
"sealed"
],
"devDependencies": {
"typescript": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/final-decorator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function Final(
ctor.__finalMethods?.add(propertyKey);

if (descriptor !== undefined) {
// Optional runtime hardening for decorated methods.
// Runtime hardening for decorated methods
descriptor.writable = false;
}
}
Loading