Skip to content

Commit

Permalink
Merge pull request #3 from joinnusteam/feat/add-presets-for-node-18-a…
Browse files Browse the repository at this point in the history
…nd-20

feat(presets): add node-hydrogen (18) and node-iron (20) presets
  • Loading branch information
nelson6e65 authored Nov 29, 2023
2 parents ef88ea5 + 60acc53 commit 6ddf77f
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 4 deletions.
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@
"require": "./dist/presets/node-gallium.cjs",
"default": "./dist/presets/node-gallium.cjs"
},
"./node-hydrogen": {
"types": "./dist/presets/node-hydrogen.d.ts",
"import": "./dist/presets/node-hydrogen.mjs",
"require": "./dist/presets/node-hydrogen.cjs",
"default": "./dist/presets/node-hydrogen.cjs"
},
"./node-iron": {
"types": "./dist/presets/node-iron.d.ts",
"import": "./dist/presets/node-iron.mjs",
"require": "./dist/presets/node-iron.cjs",
"default": "./dist/presets/node-iron.cjs"
},
"./rules": {
"types": "./dist/rules/index.d.ts",
"import": "./dist/rules/index.mjs",
Expand Down
4 changes: 0 additions & 4 deletions src/presets/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ const config: Linter.Config = {
};

export default config;

// TODO: Create presets for different versions of node
// 18.x Hydrogen 2023-09-18
// 20.x - 2023-09-28
43 changes: 43 additions & 0 deletions src/presets/node-hydrogen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Linter } from 'eslint';

import { baseRules, getImportRules, getNodeRules } from '~/rules';

/**
* Config for Node.js 16 (Gallium).
*/
const config: Linter.Config = {
overrides: [
{
files: ['*.js', '*.mjs', '*.cjs'],
parserOptions: {
ecmaVersion: 'latest',
},
extends: [
//
'eslint:recommended',
'plugin:node/recommended',
'plugin:import/recommended',
'plugin:unicorn/recommended',
'prettier',
],
plugins: [
//
'node',
'import',
'unicorn',
],
rules: {
...baseRules,
...getImportRules({
pathsGroups: [
{ group: 'internal', pattern: '@/**' },
{ group: 'internal', pattern: '~/**' },
],
}),
...getNodeRules({ nodeVersionRange: '^18.0.0' }),
},
},
],
};

export default config;
43 changes: 43 additions & 0 deletions src/presets/node-iron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Linter } from 'eslint';

import { baseRules, getImportRules, getNodeRules } from '~/rules';

/**
* Config for Node.js 16 (Gallium).
*/
const config: Linter.Config = {
overrides: [
{
files: ['*.js', '*.mjs', '*.cjs'],
parserOptions: {
ecmaVersion: 'latest',
},
extends: [
//
'eslint:recommended',
'plugin:node/recommended',
'plugin:import/recommended',
'plugin:unicorn/recommended',
'prettier',
],
plugins: [
//
'node',
'import',
'unicorn',
],
rules: {
...baseRules,
...getImportRules({
pathsGroups: [
{ group: 'internal', pattern: '@/**' },
{ group: 'internal', pattern: '~/**' },
],
}),
...getNodeRules({ nodeVersionRange: '^20.0.0' }),
},
},
],
};

export default config;

0 comments on commit 6ddf77f

Please sign in to comment.