diff --git a/package.json b/package.json index 9f705d0..53f37e2 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/presets/default.ts b/src/presets/default.ts index ec8b048..d4251d4 100644 --- a/src/presets/default.ts +++ b/src/presets/default.ts @@ -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 diff --git a/src/presets/node-hydrogen.ts b/src/presets/node-hydrogen.ts new file mode 100644 index 0000000..f93ffad --- /dev/null +++ b/src/presets/node-hydrogen.ts @@ -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; diff --git a/src/presets/node-iron.ts b/src/presets/node-iron.ts new file mode 100644 index 0000000..87f33ca --- /dev/null +++ b/src/presets/node-iron.ts @@ -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;