Skip to content
Open
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
7 changes: 0 additions & 7 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ We 💛 contributions! The rules for contributing to this project are few:

## Dependency Management

This project uses [pnpm](https://pnpm.io/) for managing dependencies. Please don't commit `package-lock.json` or `yarn.lock` files in contributions.
This project uses [pnpm](https://pnpm.io/) for managing dependencies. Please don't commit `package-lock.json` or `yarn.lock` files in contributions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
20.19.0
182 changes: 182 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{
"ignore": [
"**/*.coffee",
"**/*.css",
"**/*.hbs",
"**/*.json",
"**/*.less",
"**/*.scss",
"**/*.svg",
"dist/**",
"node_modules/**"
],
"project": [
"./apps/desktop/tsconfig.json",
"./apps/web/tsconfig.json",
"./shared/tsconfig.lint.json"
],
"rules": {
"correctness/no-array-constructor": "error",
"correctness/no-class-assign": "error",
"correctness/no-cond-assign": "error",
"correctness/no-const-assign": "error",
"correctness/no-constant-condition": "warn",
"correctness/no-control-regex": "error",
"correctness/no-debugger": "error",
"correctness/no-dupe-args": "error",
"correctness/no-dupe-class-members": "error",
"correctness/no-dupe-keys": "error",
"correctness/no-duplicate-case": "error",
"correctness/no-empty-character-class": "error",
"correctness/no-empty-pattern": "error",
"correctness/no-ex-assign": "error",
"correctness/no-func-assign": "error",
"correctness/no-invalid-regexp": "error",
"correctness/no-irregular-whitespace": "error",
"correctness/no-obj-calls": "error",
"correctness/no-octal": "error",
"correctness/no-prototype-builtins": "error",
"correctness/no-regex-spaces": "error",
"correctness/no-self-assign": "error",
"correctness/no-sparse-arrays": "error",
"correctness/no-template-curly-in-string": "error",
"correctness/no-this-before-super": "error",
"correctness/no-undef": "error",
"correctness/no-unreachable": "error",
"correctness/no-unsafe-finally": "error",
"correctness/no-unsafe-negation": "error",
"correctness/require-yield": "error",
"correctness/use-isnan": "error",
"correctness/valid-typeof": "error",
"performance/no-new-buffer": "error",
"style/camelcase": [
"error",
{
"properties": "never"
}
],
"style/capitalized-comments": "off",
"style/comma-dangle": ["error", "never"],
"style/eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"style/linebreak-style": ["error", "unix"],
"style/new-cap": [
"error",
{
"capIsNew": false,
"newIsCap": true
}
],
"style/no-bitwise": "error",
"style/no-continue": "error",
"style/no-else-return": "error",
"style/no-lonely-if": "error",
"style/no-multi-assign": ["error"],
"style/no-new-object": "error",
"style/no-param-reassign": ["warn", { "props": false }],
"style/no-plusplus": [
"error",
{
"allowForLoopAfterthoughts": true
}
],
"style/no-unneeded-ternary": [
"error",
{
"defaultAssignment": false
}
],
"style/no-var": "error",
"style/object-shorthand": [
"error",
"always",
{
"avoidQuotes": true,
"ignoreConstructors": false
}
],
"style/one-var": ["error", "never"],
"style/operator-assignment": ["error", "always"],
"style/prefer-const": [
"error",
{
"destructuring": "any",
"ignoreReadBeforeAssign": true
}
],
"style/prefer-destructuring": [
"warn",
{
"array": false,
"object": true
}
],
"style/prefer-numeric-literals": "error",
"style/prefer-rest-params": "error",
"style/prefer-spread": "error",
"style/prefer-template": "error",
"style/radix": "error",
"style/spaced-comment": ["error", "always"],
"style/strict": "error",
"style/symbol-description": "error",
"style/vars-on-top": "error",
"style/yoda": "error",
"suspicious/no-await-in-loop": "error",
"suspicious/no-compare-neg-zero": "error",
"suspicious/no-empty": ["error", { "allowEmptyCatch": true }],
"suspicious/no-empty-function": [
"error",
{
"allow": ["arrowFunctions", "functions", "methods"]
}
],
"suspicious/no-eval": "error",
"suspicious/no-extend-native": "error",
"suspicious/no-extra-bind": "error",
"suspicious/no-extra-boolean-cast": "error",
"suspicious/no-fallthrough": "error",
"suspicious/no-global-assign": "error",
"suspicious/no-implied-eval": "error",
"suspicious/no-inner-declarations": "error",
"suspicious/no-iterator": "error",
"suspicious/no-labels": "error",
"suspicious/no-lone-blocks": "error",
"suspicious/no-loop-func": "error",
"suspicious/no-multi-str": "error",
"suspicious/no-new": "error",
"suspicious/no-new-func": "error",
"suspicious/no-new-wrappers": "error",
"suspicious/no-octal-escape": "error",
"suspicious/no-return-assign": "error",
"suspicious/no-return-await": "error",
"suspicious/no-script-url": "error",
"suspicious/no-self-compare": "error",
"suspicious/no-sequences": "error",
"suspicious/no-throw-literal": "error",
"suspicious/no-unmodified-loop-condition": "off",
"suspicious/no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": false
}
],
"suspicious/no-unused-labels": "error",
"suspicious/no-useless-concat": "error",
"suspicious/no-useless-constructor": "error",
"suspicious/no-useless-escape": "error",
"suspicious/no-useless-return": "error",
"suspicious/no-void": "off",
"suspicious/no-with": "error",
"unicorn/no-new-array": "off",
"unicorn/no-useless-fallback-in-spread": "off",
"react/rules-of-hooks": "error",
"react/exhaustive-deps": "warn"
},
"typescript": true
}
9 changes: 8 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
"eslint-config-shellscape/configs/prettier.json"
{
"arrowParens": "always",
"importOrder": ["<BUILTIN_MODULES>", "", "<THIRD_PARTY_MODULES>", "", "^[~]", "", "^[.]"],
"plugins": ["@ianvs/prettier-plugin-sort-imports", "prettier-plugin-package"],
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none"
}
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ npm install loglevelnext --save
Users can choose to use `loglevelnext` in Node.js or in the client (browser).

```js
const log = require('loglevelnext');
import log from 'loglevelnext';

log.info('bananas!');
```
Expand All @@ -48,14 +48,14 @@ By default `loglevelnext` ships supporting the following log level name-value
pairs:

```js
{
const levels = {
TRACE: 0,
DEBUG: 1,
INFO: 2,
WARN: 3,
ERROR: 4,
SILENT: 5
}
};
```

## Default Logger
Expand All @@ -72,7 +72,7 @@ These methods correspond to the available log levels and accept parameters ident

```js
console.info('...');
console.info('...');
console.debug('...');
// ... etc
```

Expand All @@ -86,20 +86,23 @@ _Note: `LogLevel` instances created are cached. Calling `create` with a previous

#### `factories`

Type: `Array [ Class ]`
Type: `Class[]`

Returns an `Array` containing the factory classes available within `loglevelnext`
to outside modules. Particularly useful when creating plugins. eg.

```js
const log = require('loglevelnext');
import log from 'loglevelnext';

const { MethodFactory } = log.factories;
class MyFactory extends MethodFactory { ... }
class MyFactory extends MethodFactory {
// ...
}
```

#### `loggers`

Type: `Array [ LogLevel ]`
Type: `LogLevel[]`

Returns an `Array` containing references to the currently instantiated loggers.

Expand Down
65 changes: 23 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,31 @@
"repository": "shellscape/loglevelnext",
"author": "Andrew Powell <andrew@shellscape.org>",
"homepage": "https://github.com/shellscape/loglevelnext",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
}
},
"engines": {
"node": ">= 18"
"node": ">= 20.19.0"
},
"scripts": {
"build": "tsup src/index.ts --format esm,cjs --dts",
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
"build": "tsc --project tsconfig.json --noEmit false",
"ci:coverage": "vitest run --coverage && vitest coverage report --reporter=lcov",
"commitlint": "commitlint",
"commitmsg": "commitlint -e $GIT_PARAMS",
"lint": "pnpm lint:docs && pnpm lint:json && pnpm lint:package && pnpm lint:js",
"lint-staged": "lint-staged",
"lint:docs": "prettier --write .github/**/*.md **/README.md",
"lint:js": "eslint --fix --cache src test",
"lint:js": "oxlint --format stylish src test",
"lint:json": "prettier --write tsconfig.*.json",
"lint:package": "prettier --write **/package.json --plugin=prettier-plugin-package",
"prebuild": "tsc --project tsconfig.json",
"prepublishOnly": "pnpm build",
"security": "pnpm audit --audit-level high",
"test": "FORCE_COLOR=3 ava"
"test": "vitest run"
},
"files": [
"dist",
Expand All @@ -62,42 +55,30 @@
"warn"
],
"devDependencies": {
"@commitlint/cli": "17.8.0",
"@commitlint/config-conventional": "17.8.0",
"@types/node": "^20.8.6",
"@types/sinon": "^10.0.2",
"ava": "^5.3.1",
"chalk": "^4.0.0",
"eslint-config-shellscape": "^6.0.1",
"husky": "^8.0.3",
"lint-staged": "15.0.1",
"nyc": "^15.0.1",
"@commitlint/cli": "19.8.1",
"@commitlint/config-conventional": "19.8.1",
"@ianvs/prettier-plugin-sort-imports": "^4.5.1",
"@types/node": "^24.1.0",
"@types/sinon": "^17.0.4",
"chalk": "^5.4.1",
"husky": "^9.1.7",
"lint-staged": "16.1.2",
"oxlint": "^0.16.3",
"pre-commit": "^1.2.2",
"sinon": "11.1.1",
"ts-node": "^10.0.0",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
"sinon": "21.0.0",
"tsx": "^4.20.3",
"typescript": "^5.2.2",
"vitest": "^2.1.4"
},
"types": "./dist/index.d.ts",
"ava": {
"extensions": [
"ts"
],
"require": [
"ts-node/register"
],
"files": [
"test/*.ts"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,js}": [
"eslint --fix"
"oxlint --format stylish src test"
],
"*.{json,md,yml,yaml}": [
"prettier --write"
Expand All @@ -106,4 +87,4 @@
"prettier --write --plugin=prettier-plugin-package"
]
}
}
}
Loading
Loading