this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add eslint configs

+87 -34
+10 -3
eslint.config.js
··· 1 1 import e18e from '@e18e/eslint-plugin'; 2 - import {defineConfig} from 'eslint/config'; 2 + import deMorgan from 'eslint-plugin-de-morgan'; 3 3 import packageJson from 'eslint-plugin-package-json'; 4 + import perfectionist from 'eslint-plugin-perfectionist'; 5 + import {defineConfig} from 'eslint/config'; 4 6 import xo from 'xo'; 5 7 6 8 export default defineConfig([ 7 9 { 8 - files: ['**/*.js'], 9 10 extends: [ 11 + deMorgan.configs.recommended, 10 12 e18e.configs.recommended, 13 + perfectionist.configs['recommended-natural'], 11 14 xo.xoToEslintConfig([ 12 15 { 13 16 prettier: 'compat', 17 + rules: { 18 + 'import-x/order': 'off', 19 + }, 14 20 }, 15 21 ]), 16 22 ], 23 + files: ['**/*.js'], 17 24 rules: { 18 25 'e18e/prefer-static-regex': 'off', 19 26 }, 20 27 }, 21 28 { 22 - files: ['package.json'], 23 29 extends: [packageJson.configs.recommended, packageJson.configs.stylistic], 30 + files: ['package.json'], 24 31 rules: { 25 32 'package-json/require-exports': 'off', 26 33 'package-json/require-sideEffects': 'off',
+42
package-lock.json
··· 25 25 "devDependencies": { 26 26 "@e18e/eslint-plugin": "^0.3.0", 27 27 "eslint": "^10.0.3", 28 + "eslint-plugin-de-morgan": "^2.1.1", 28 29 "eslint-plugin-package-json": "^0.91.0", 30 + "eslint-plugin-perfectionist": "^5.8.0", 29 31 "knip": "^6.3.1", 30 32 "prettier": "^3.5.3", 31 33 "xo": "^2.0.1" ··· 3768 3770 "eslint": ">=10" 3769 3771 } 3770 3772 }, 3773 + "node_modules/eslint-plugin-de-morgan": { 3774 + "version": "2.1.1", 3775 + "resolved": "https://registry.npmjs.org/eslint-plugin-de-morgan/-/eslint-plugin-de-morgan-2.1.1.tgz", 3776 + "integrity": "sha512-0CeQ38b8hMMa3gO5vLnGcQS/xatvYno9RvjKoZ4UVaHjzvHZhR9i6+0ZkZhbbZF1FW7rqrS2MtcH3tVBejrmHQ==", 3777 + "dev": true, 3778 + "license": "MIT", 3779 + "engines": { 3780 + "node": "^20.0.0 || >=22.0.0" 3781 + }, 3782 + "peerDependencies": { 3783 + "eslint": "^8.45.0 || ^9.0.0 || ^10.0.0" 3784 + } 3785 + }, 3771 3786 "node_modules/eslint-plugin-depend": { 3772 3787 "version": "1.5.0", 3773 3788 "resolved": "https://registry.npmjs.org/eslint-plugin-depend/-/eslint-plugin-depend-1.5.0.tgz", ··· 3907 3922 "peerDependencies": { 3908 3923 "eslint": ">=8.0.0", 3909 3924 "jsonc-eslint-parser": ">=2.0.0" 3925 + } 3926 + }, 3927 + "node_modules/eslint-plugin-perfectionist": { 3928 + "version": "5.8.0", 3929 + "resolved": "https://registry.npmjs.org/eslint-plugin-perfectionist/-/eslint-plugin-perfectionist-5.8.0.tgz", 3930 + "integrity": "sha512-k8uIptWIxkUclonCFGyDzgYs9NI+Qh0a7cUXS3L7IYZDEsjXuimFBVbxXPQQngWqMiaxJRwbtYB4smMGMqF+cw==", 3931 + "dev": true, 3932 + "license": "MIT", 3933 + "dependencies": { 3934 + "@typescript-eslint/utils": "^8.58.0", 3935 + "natural-orderby": "^5.0.0" 3936 + }, 3937 + "engines": { 3938 + "node": "^20.0.0 || >=22.0.0" 3939 + }, 3940 + "peerDependencies": { 3941 + "eslint": "^8.45.0 || ^9.0.0 || ^10.0.0" 3910 3942 } 3911 3943 }, 3912 3944 "node_modules/eslint-plugin-prettier": { ··· 6034 6066 "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", 6035 6067 "dev": true, 6036 6068 "license": "MIT" 6069 + }, 6070 + "node_modules/natural-orderby": { 6071 + "version": "5.0.0", 6072 + "resolved": "https://registry.npmjs.org/natural-orderby/-/natural-orderby-5.0.0.tgz", 6073 + "integrity": "sha512-kKHJhxwpR/Okycz4HhQKKlhWe4ASEfPgkSWNmKFHd7+ezuQlxkA5cM3+XkBPvm1gmHen3w53qsYAv+8GwRrBlg==", 6074 + "dev": true, 6075 + "license": "MIT", 6076 + "engines": { 6077 + "node": ">=18" 6078 + } 6037 6079 }, 6038 6080 "node_modules/node-exports-info": { 6039 6081 "version": "1.6.0",
+2
package.json
··· 54 54 "devDependencies": { 55 55 "@e18e/eslint-plugin": "^0.3.0", 56 56 "eslint": "^10.0.3", 57 + "eslint-plugin-de-morgan": "^2.1.1", 57 58 "eslint-plugin-package-json": "^0.91.0", 59 + "eslint-plugin-perfectionist": "^5.8.0", 58 60 "knip": "^6.3.1", 59 61 "prettier": "^3.5.3", 60 62 "xo": "^2.0.1"
+1 -1
source/cli.js
··· 1 1 #! /usr/bin/env node 2 2 3 - import {program} from 'commander'; 4 3 import * as commands from '#cli/commands'; 5 4 import packageJson from '#package-json' with {type: 'json'}; 5 + import {program} from 'commander'; 6 6 7 7 program 8 8 .name(packageJson.name)
+2 -2
source/cli/actions/config/index.js
··· 1 - export {default as show} from './show.js'; 2 - export {default as set} from './set.js'; 3 1 export {default as setMode} from './set-mode.js'; 2 + export {default as set} from './set.js'; 3 + export {default as show} from './show.js';
+1 -1
source/cli/actions/config/set-mode.js
··· 1 + import {getConfig, getCurrentMode} from '#library'; 1 2 import {consola} from 'consola'; 2 3 import {getTerminalProfiles, setTerminalProfile} from 'mac-terminal'; 3 4 import ow from 'ow'; 4 - import {getConfig, getCurrentMode} from '#library'; 5 5 6 6 /** 7 7 * @param {{mode: 'dark' | 'light', profile: string}} parameters
+4 -4
source/cli/actions/config/set.js
··· 1 + import {getConfig, getCurrentMode, modes} from '#library'; 1 2 import {consola} from 'consola'; 2 3 import {getTerminalProfiles, setTerminalProfile} from 'mac-terminal'; 3 - import {getConfig, getCurrentMode, modes} from '#library'; 4 4 5 5 /** 6 6 * @returns {Promise<void>} ··· 15 15 const selectedProfile = await consola.prompt( 16 16 `select ${mode} mode profile`, 17 17 { 18 - type: 'select', 19 - options: profiles, 20 - initial: config.get(`profiles.${mode}`), 21 18 cancel: 'undefined', 19 + initial: config.get(`profiles.${mode}`), 20 + options: profiles, 21 + type: 'select', 22 22 }, 23 23 ); 24 24
+1 -1
source/cli/actions/config/show.js
··· 1 + import {getConfig, modes} from '#library'; 1 2 // eslint-disable-next-line n/prefer-global/console 2 3 import console from 'node:console'; 3 4 import {styleText} from 'node:util'; 4 - import {getConfig, modes} from '#library'; 5 5 6 6 /** 7 7 * @returns {Promise<void>}
+1 -1
source/cli/actions/index.js
··· 1 - export {default as update} from './update.js'; 2 1 export * as config from './config/index.js'; 2 + export {default as update} from './update.js';
+1 -1
source/cli/actions/update.js
··· 1 - import {setTerminalProfile} from 'mac-terminal'; 2 1 import {getConfig, getCurrentMode} from '#library'; 2 + import {setTerminalProfile} from 'mac-terminal'; 3 3 4 4 /** 5 5 * @param {{mode?: 'dark' | 'light'}} parameters
+2 -1
source/cli/commands/config/config.js
··· 1 1 import {Command} from 'commander'; 2 + 3 + import set from './set.js'; 2 4 import show from './show.js'; 3 - import set from './set.js'; 4 5 5 6 export default new Command('config') 6 7 .description('manage configuration')
+1 -1
source/cli/commands/config/set-mode.js
··· 1 + import * as actions from '#cli/actions'; 1 2 import {Command} from 'commander'; 2 3 import {ArgumentError} from 'ow'; 3 - import * as actions from '#cli/actions'; 4 4 5 5 /** 6 6 * Make set mode command
+3 -2
source/cli/commands/config/set.js
··· 1 + import * as actions from '#cli/actions'; 2 + import {modes} from '#library'; 1 3 import {Command} from 'commander'; 4 + 2 5 import setMode from './set-mode.js'; 3 - import * as actions from '#cli/actions'; 4 - import {modes} from '#library'; 5 6 6 7 const command = new Command('set').description('update configuration'); 7 8
+1 -1
source/cli/commands/config/show.js
··· 1 - import {Command} from 'commander'; 2 1 import * as actions from '#cli/actions'; 2 + import {Command} from 'commander'; 3 3 4 4 export default new Command('show') 5 5 .description('show configuration')
+1 -1
source/cli/commands/update.js
··· 1 - import {Argument, Command} from 'commander'; 2 1 import * as actions from '#cli/actions'; 3 2 import {modes} from '#library'; 3 + import {Argument, Command} from 'commander'; 4 4 5 5 export default new Command('update') 6 6 .description('update terminal profile based on the mode')
+8 -8
source/library/get-config.js
··· 1 + import packageJson from '#package-json' with {type: 'json'}; 1 2 import Conf from 'conf'; 2 3 import {getTerminalDefaultProfile} from 'mac-terminal'; 3 - import packageJson from '#package-json' with {type: 'json'}; 4 4 5 5 export default async function getConfig() { 6 6 const defaultProfile = await getTerminalDefaultProfile(); 7 7 8 8 const config = new Conf({ 9 + defaults: { 10 + profiles: { 11 + dark: defaultProfile, 12 + light: defaultProfile, 13 + }, 14 + }, 9 15 projectName: packageJson.name, 10 16 schema: { 11 17 profiles: { 12 - type: 'object', 13 18 properties: { 14 19 dark: { 15 20 type: 'string', ··· 18 23 type: 'string', 19 24 }, 20 25 }, 21 - }, 22 - }, 23 - defaults: { 24 - profiles: { 25 - dark: defaultProfile, 26 - light: defaultProfile, 26 + type: 'object', 27 27 }, 28 28 }, 29 29 });
+2 -2
test/cli/actions/config/set-mode.js
··· 1 - import {beforeEach, describe, it, mock} from 'node:test'; 2 1 import assert from 'node:assert/strict'; 2 + import {beforeEach, describe, it, mock} from 'node:test'; 3 3 4 4 const consola = {success: mock.fn()}; 5 5 mock.module('consola', {namedExports: {consola}}); ··· 12 12 13 13 const config = {set: mock.fn()}; 14 14 const library = { 15 - getCurrentMode: mock.fn(), 16 15 getConfig: mock.fn(async () => config), 16 + getCurrentMode: mock.fn(), 17 17 }; 18 18 mock.module('#library', {namedExports: library}); 19 19
+1 -1
test/cli/actions/config/show.js
··· 1 - import {beforeEach, describe, it, mock} from 'node:test'; 2 1 import assert from 'node:assert/strict'; 2 + import {beforeEach, describe, it, mock} from 'node:test'; 3 3 4 4 const console = { 5 5 log: mock.fn(),
+1 -1
test/library/get-current-mode.js
··· 1 - import {beforeEach, describe, it, mock} from 'node:test'; 2 1 import assert from 'node:assert/strict'; 2 + import {beforeEach, describe, it, mock} from 'node:test'; 3 3 4 4 const darkMode = {isEnabled: mock.fn()}; 5 5 mock.module('dark-mode', {defaultExport: darkMode});
+2 -2
test/update.js
··· 1 - import {beforeEach, describe, it, mock} from 'node:test'; 2 1 import assert from 'node:assert/strict'; 2 + import {beforeEach, describe, it, mock} from 'node:test'; 3 3 4 4 const macTerminal = {setTerminalProfile: mock.fn()}; 5 5 mock.module('mac-terminal', {namedExports: macTerminal}); 6 6 7 7 const config = {get: mock.fn()}; 8 8 const library = { 9 - getCurrentMode: mock.fn(), 10 9 getConfig: mock.fn(async () => config), 10 + getCurrentMode: mock.fn(), 11 11 }; 12 12 mock.module('#library', {namedExports: library}); 13 13