@slango.configs/lint-staged 1.1.36 → 2.0.0

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/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # ![Lint-staged](https://img.shields.io/badge/lint--staged-3AC486?style=flat-square) Slango Lint-Staged Configs (@slango.configs/lint-staged)
2
2
 
3
- This package exposes eslint configurations for easy setup, the following presets are available:
3
+ This package exposes lint-staged configurations for easy setup, the following presets are available:
4
4
 
5
- | Name | Description | Includes | Tasks |
6
- | ------------ | ---------------------------------------- | ------------------------ | ------------------------------------ |
7
- | `debug` | Intended for debugging purposes | - | fail |
8
- | `default` | Preset to be used in no-code packages | - | prettier |
9
- | `javascript` | Preset to be used in javascript packages | `default` | prettier + eslint |
10
- | `typescript` | Preset to be used in typescript packages | `default` + `javascript` | prettier + eslint + typescript check |
5
+ | Name | Description | Includes | Tasks |
6
+ | ---------------------------- | ----------------------------------------------------------------------- | ------------------------------- | ------------------------------------------------ |
7
+ | `debug` | Intended for debugging purposes | - | fail |
8
+ | `default` | Preset to be used in no-code packages | - | prettier |
9
+ | `javascript-oxlint` | `javascript` for packages linted with oxlint (`@slango.configs/oxlint`) | `default` | prettier + oxlint |
10
+ | `typescript-oxlint` | `typescript` for packages linted with oxlint (`@slango.configs/oxlint`) | `default` + `javascript-oxlint` | prettier + oxlint + typescript check |
11
+ | `typescript-oxlint-no-tests` | `typescript-oxlint` for packages without tests | `default` + `javascript-oxlint` | prettier + oxlint + typescript check (no vitest) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slango.configs/lint-staged",
3
- "version": "1.1.36",
3
+ "version": "2.0.0",
4
4
  "private": false,
5
5
  "description": "Slango lint-staged configs",
6
6
  "repository": {
@@ -22,11 +22,11 @@
22
22
  "lint-staged": "^17.4.1"
23
23
  },
24
24
  "devDependencies": {
25
- "@slango.configs/eslint": "1.2.44",
26
- "eslint": "10.9.1"
25
+ "@slango.configs/oxlint": "0.1.2",
26
+ "oxlint": "1.81.0"
27
27
  },
28
28
  "scripts": {
29
- "lint": "eslint . --max-warnings 0",
30
- "lint:fix": "eslint . --fix --max-warnings 0"
29
+ "lint": "oxlint --max-warnings 0 .",
30
+ "lint:fix": "oxlint --fix --max-warnings 0 ."
31
31
  }
32
32
  }
package/src/commands.js CHANGED
@@ -1,7 +1,8 @@
1
1
  export const prettier = 'prettier --ignore-unknown --write';
2
2
 
3
- export const eslintFix =
4
- 'eslint --fix --max-warnings 0 --cache --cache-strategy content --no-ignore';
3
+ export const oxlintFix = 'oxlint --fix --max-warnings 0';
4
+
5
+ export const oxlintTypeAwareFix = 'oxlint --type-aware --fix --max-warnings 0';
5
6
 
6
7
  // This is a function because tsc --noEmit cannot be used with files (which is the default behavior of lint-staged)
7
8
  export const typescriptBuildCheck = () => 'tsc --noEmit';
@@ -0,0 +1,8 @@
1
+ import { oxlintJavascriptTask, prettierAllTask } from '../tasks.js';
2
+
3
+ const javascriptOxlintConfig = {
4
+ ...prettierAllTask,
5
+ ...oxlintJavascriptTask,
6
+ };
7
+
8
+ export default javascriptOxlintConfig;
@@ -0,0 +1,17 @@
1
+ import deepmerge from 'deepmerge';
2
+
3
+ import {
4
+ buildCheckTypescriptTask,
5
+ oxlintJavascriptTask,
6
+ oxlintTypescriptTask,
7
+ prettierAllTask,
8
+ } from '../tasks.js';
9
+
10
+ // `typescript-oxlint` without the vitest task, for packages that have no tests.
11
+ const typescriptOxlintNoTestsConfig = {
12
+ ...prettierAllTask,
13
+ ...oxlintJavascriptTask,
14
+ ...deepmerge.all([oxlintTypescriptTask, buildCheckTypescriptTask]),
15
+ };
16
+
17
+ export default typescriptOxlintNoTestsConfig;
@@ -0,0 +1,17 @@
1
+ import deepmerge from 'deepmerge';
2
+
3
+ import {
4
+ buildCheckTypescriptTask,
5
+ oxlintJavascriptTask,
6
+ oxlintTypescriptTask,
7
+ prettierAllTask,
8
+ vitestTypescriptTask,
9
+ } from '../tasks.js';
10
+
11
+ const typescriptOxlintConfig = {
12
+ ...prettierAllTask,
13
+ ...oxlintJavascriptTask,
14
+ ...deepmerge.all([oxlintTypescriptTask, buildCheckTypescriptTask, vitestTypescriptTask]),
15
+ };
16
+
17
+ export default typescriptOxlintConfig;
package/src/tasks.js CHANGED
@@ -1,16 +1,23 @@
1
- import { eslintFix, prettier, typescriptBuildCheck, vitest } from './commands.js';
1
+ import {
2
+ oxlintFix,
3
+ oxlintTypeAwareFix,
4
+ prettier,
5
+ typescriptBuildCheck,
6
+ vitest,
7
+ } from './commands.js';
2
8
  import { allGlob, javascriptGlob, typescriptGlob } from './globs.js';
3
9
 
4
10
  export const prettierAllTask = {
5
11
  [allGlob]: [prettier],
6
12
  };
7
-
8
- export const eslintJavascriptTask = {
9
- [javascriptGlob]: [eslintFix],
13
+ // oxlint applies JS-plugin fixes (perfectionist) in a single pass, so sorting
14
+ // imports and then their named specifiers needs a second run to converge.
15
+ export const oxlintJavascriptTask = {
16
+ [javascriptGlob]: [oxlintFix, oxlintFix],
10
17
  };
11
18
 
12
- export const eslintTypescriptTask = {
13
- [typescriptGlob]: [eslintFix],
19
+ export const oxlintTypescriptTask = {
20
+ [typescriptGlob]: [oxlintTypeAwareFix, oxlintTypeAwareFix],
14
21
  };
15
22
 
16
23
  export const buildCheckTypescriptTask = {
@@ -1,8 +0,0 @@
1
- import { eslintJavascriptTask, prettierAllTask } from '../tasks.js';
2
-
3
- const javascriptConfig = {
4
- ...prettierAllTask,
5
- ...eslintJavascriptTask,
6
- };
7
-
8
- export default javascriptConfig;
@@ -1,17 +0,0 @@
1
- import deepmerge from 'deepmerge';
2
-
3
- import {
4
- buildCheckTypescriptTask,
5
- eslintJavascriptTask,
6
- eslintTypescriptTask,
7
- prettierAllTask,
8
- vitestTypescriptTask,
9
- } from '../tasks.js';
10
-
11
- const typescriptConfig = {
12
- ...prettierAllTask,
13
- ...eslintJavascriptTask,
14
- ...deepmerge.all([eslintTypescriptTask, buildCheckTypescriptTask, vitestTypescriptTask]),
15
- };
16
-
17
- export default typescriptConfig;