-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new utility functions, tests and update project settings
- Loading branch information
Showing
21 changed files
with
6,893 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Makefile] | ||
indent_style = tab | ||
|
||
[*.js] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '23.x' | ||
|
||
- name: Install dependencies | ||
run: make install | ||
|
||
- name: Run tests | ||
run: make test | ||
|
||
- name: Run linter | ||
run: make lint | ||
|
||
- name: Test & publish code coverage | ||
uses: paambaati/[email protected] | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
with: | ||
coverageCommand: make test-coverage | ||
debug: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node-options=--no-warnings --experimental-vm-modules | ||
engine=jest | ||
max_old_space_size=4096 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"ignore_dirs": ["node_modules", ".git"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
install: | ||
npm ci | ||
|
||
gen-diff: | ||
node bin/brain-games.js | ||
|
||
publish: | ||
npm publish --dry-run | ||
|
||
link: | ||
npm link | ||
install: deps-install | ||
npx simple-git-hooks | ||
|
||
gen-diff-demonstration: | ||
node bin/gen-diff.js __fixtures__/file1.json __fixtures__/file2.json | ||
|
||
deps-install: | ||
npm ci --legacy-peer-deps | ||
|
||
deps-update: | ||
npx ncu -u | ||
|
||
test: | ||
npx jest | ||
|
||
test-coverage: | ||
npx jest --coverage --coverageProvider=v8 | ||
|
||
lint: | ||
npx eslint . | ||
|
||
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
- follow: false | ||
host: hexlet.io | ||
- proxy: 123.234.53.22 | ||
- timeout: 50 | ||
+ timeout: 20 | ||
+ verbose: true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import globals from 'globals'; | ||
import { FlatCompat } from '@eslint/eslintrc'; | ||
import pluginJs from '@eslint/js'; | ||
import importPlugin from 'eslint-plugin-import'; | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
|
||
import { __dirname } from './globals.js'; | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: pluginJs.configs.recommended, | ||
}); | ||
|
||
export default [ | ||
{ | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js'], | ||
}, | ||
}, | ||
}, | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.node, | ||
...globals.jest, | ||
}, | ||
parserOptions: { | ||
// Eslint doesn't supply ecmaVersion in `parser.js` `context.parserOptions` | ||
// This is required to avoid ecmaVersion < 2015 error or 'import' / 'export' error | ||
ecmaVersion: 2025, | ||
sourceType: 'module', | ||
}, | ||
}, | ||
plugins: { | ||
import: importPlugin, | ||
}, | ||
rules: { | ||
...importPlugin.configs.recommended.rules, | ||
}, | ||
}, | ||
...compat.extends('airbnb-base'), | ||
{ | ||
rules: { | ||
'no-underscore-dangle': [ | ||
'error', | ||
{ | ||
allow: ['__filename', '__dirname'], | ||
}, | ||
], | ||
'import/extensions': [ | ||
'error', | ||
{ | ||
js: 'always', | ||
}, | ||
], | ||
// FIXME: getting error with ?? operator, when enabled | ||
'import/named': ['off'], | ||
'import/no-named-as-default': 'off', | ||
'import/no-named-as-default-member': 'off', | ||
'import/no-extraneous-dependencies': 'off', | ||
'import/prefer-default-export': 'off', | ||
'max-len': ['warn', { code: 120 }], | ||
'no-unused-vars': 'error', | ||
'no-console': 'off', | ||
'no-debugger': 'warn', | ||
'prefer-const': 'error', | ||
'import/no-unresolved': 'error', | ||
'import/order': [ | ||
'error', { | ||
'newlines-between': 'always', | ||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], | ||
}], | ||
indent: ['error', 2], | ||
semi: ['error', 'always'], | ||
quotes: ['error', 'single'], | ||
}, | ||
}, | ||
eslintConfigPrettier, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { fileURLToPath } from 'url'; | ||
import path from 'path'; | ||
|
||
export const __filename = fileURLToPath(import.meta.url); | ||
export const __dirname = path.dirname(__filename); |
Oops, something went wrong.