Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 56 additions & 56 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
'use strict';
"use strict";

const airbnbBase = require('eslint-config-airbnb-base');
const airbnbBase = require("eslint-config-airbnb-base");

// eslint-disable-next-line import/no-dynamic-require
const bestPractices = require(airbnbBase.extends[0]);

const ignoredProps = bestPractices.rules[
'no-param-reassign'
"no-param-reassign"
][1].ignorePropertyModificationsFor.concat(
'err',
'x',
'_',
'opts',
'options',
'settings',
'config',
'cfg',
"err",
"x",
"_",
"opts",
"options",
"settings",
"config",
"cfg"
);

// Additional rules that are specific and overriding previous
const additionalChanges = {
strict: 'off',
strict: "off",

// Enforce using named functions when regular function is used,
// otherwise use arrow functions
'func-names': ['error', 'always'],
"func-names": ["error", "always"],
// Always use parens (for consistency).
// https://eslint.org/docs/rules/arrow-parens
'arrow-parens': ['error', 'always', { requireForBlockBody: true }],
'prefer-arrow-callback': [
'error',
"arrow-parens": ["error", "always", { requireForBlockBody: true }],
"prefer-arrow-callback": [
"error",
{ allowNamedFunctions: true, allowUnboundThis: true },
],
// http://eslint.org/docs/rules/max-params
'max-params': ['error', { max: 3 }],
"max-params": ["error", { max: 3 }],
// http://eslint.org/docs/rules/max-statements
'max-statements': ['error', { max: 20 }],
"max-statements": ["error", { max: 20 }],
// http://eslint.org/docs/rules/max-statements-per-line
'max-statements-per-line': ['error', { max: 1 }],
"max-statements-per-line": ["error", { max: 1 }],
// http://eslint.org/docs/rules/max-nested-callbacks
'max-nested-callbacks': ['error', { max: 4 }],
"max-nested-callbacks": ["error", { max: 4 }],
// http://eslint.org/docs/rules/max-depth
'max-depth': ['error', { max: 4 }],
"max-depth": ["error", { max: 4 }],
// enforces no braces where they can be omitted
// https://eslint.org/docs/rules/arrow-body-style
// Never enable for object literal.
'arrow-body-style': [
'error',
'as-needed',
"arrow-body-style": [
"error",
"as-needed",
{ requireReturnForObjectLiteral: false },
],
// Allow functions to be use before define because:
// 1) they are hoisted,
// 2) because ensure read flow is from top to bottom
// 3) logically order of the code.
// 4) the only addition is 'typedefs' option, see overrides for TS files
'no-use-before-define': [
'error',
"no-use-before-define": [
"error",
{
functions: false,
classes: true,
Expand All @@ -67,45 +67,45 @@ const additionalChanges = {
// disallow reassignment of function parameters
// disallow parameter object manipulation except for specific exclusions
// rule: https://eslint.org/docs/rules/no-param-reassign.html
'no-param-reassign': [
'error',
"no-param-reassign": [
"error",
{
props: true,
ignorePropertyModificationsFor: ignoredProps,
},
],

// disallow declaration of variables that are not used in the code
'no-unused-vars': [
'error',
"no-unused-vars": [
"error",
{
ignoreRestSiblings: true, // airbnb's default
vars: 'all', // airbnb's default
varsIgnorePattern: '^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))',
args: 'after-used', // airbnb's default
argsIgnorePattern: '^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))',
vars: "all", // airbnb's default
varsIgnorePattern: "^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))",
args: "after-used", // airbnb's default
argsIgnorePattern: "^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))",

// catch blocks are handled by Unicorns
caughtErrors: 'none',
caughtErrors: "none",
// caughtErrorsIgnorePattern: '^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))',
},
],
};

const importRules = {
'import/namespace': ['error', { allowComputed: true }],
'import/no-absolute-path': 'error',
'import/no-webpack-loader-syntax': 'error',
'import/no-self-import': 'error',
"import/namespace": ["error", { allowComputed: true }],
"import/no-absolute-path": "error",
"import/no-webpack-loader-syntax": "error",
"import/no-self-import": "error",

// Enable this sometime in the future when Node.js has ES2015 module support
// 'import/no-cycle': 'error',

// Disabled as it doesn't work with TypeScript
// 'import/newline-after-import': 'error',

'import/no-amd': 'error',
'import/no-duplicates': 'error',
"import/no-amd": "error",
"import/no-duplicates": "error",

// Enable this sometime in the future when Node.js has ES2015 module support
// 'import/unambiguous': 'error',
Expand All @@ -116,10 +116,10 @@ const importRules = {
// Looks useful, but too unstable at the moment
// 'import/no-deprecated': 'error',

'import/no-extraneous-dependencies': 'off',
'import/no-mutable-exports': 'error',
'import/no-named-as-default-member': 'error',
'import/no-named-as-default': 'error',
"import/no-extraneous-dependencies": "off",
"import/no-mutable-exports": "error",
"import/no-named-as-default-member": "error",
"import/no-named-as-default": "error",

// Disabled because it's buggy and it also doesn't work with TypeScript
// 'import/no-unresolved': [
Expand All @@ -129,32 +129,32 @@ const importRules = {
// }
// ],

'import/order': 'error',
'import/no-unassigned-import': [
'error',
{ allow: ['@babel/polyfill', '@babel/register'] },
"import/order": "error",
"import/no-unassigned-import": [
"error",
{ allow: ["@babel/polyfill", "@babel/register"] },
],

'import/prefer-default-export': 'off',
"import/prefer-default-export": "off",

// Ensure more web-compat
// ! note that it doesn't work in CommonJS
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
'import/extensions': 'off',
"import/extensions": "off",

// ? Always use named exports. Enable?
// 'import/no-default-export': 'error',

// ? enable?
'import/exports-last': 'off',
"import/exports-last": "off",

// todo: Enable in future.
// Ensures everything is tested (all exports should be used).
// For cases when you don't want or can't test, add eslint-ignore comment!
// see: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unused-modules.md
'import/no-unused-modules': 'off',
"import/no-unused-modules": "off",

'import/no-useless-path-segments': ['error', { noUselessIndex: false }],
"import/no-useless-path-segments": ["error", { noUselessIndex: false }],
};

module.exports = {
Expand All @@ -165,8 +165,8 @@ module.exports = {
node: true,
commonjs: true,
},
extends: ['eslint:recommended', 'airbnb-base', 'plugin:prettier/recommended'],
plugins: ['prettier'],
extends: ["eslint:recommended", "airbnb-base", "plugin:prettier/recommended"],
plugins: ["prettier"],
rules: {
...additionalChanges,
...importRules,
Expand Down
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
Expand Down
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '0 2 * * *'
- cron: "0 2 * * *"

jobs:
analyze:
Expand All @@ -32,39 +32,39 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Checkout repository
uses: actions/checkout@v5

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ name: ci
on:
push:
branches:
- '*'
- "*"
pull_request:
branches:
- '*'
- "*"

jobs:
build-and-test:
Expand All @@ -65,7 +65,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [18, 20, 22, 'lts/*']
node-version: [18, 20, 22, "lts/*"]

steps:
- name: Checkout
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
!*.md*
!*.y*ml

pnpm-lock.yaml

!**/src
!**/src/**

Expand Down
23 changes: 23 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict";

const config = require("@tunnckocore/prettier-config");

module.exports = {
...config,
overrides: [
{
files: ["**/*.md*"],
options: {
proseWrap: "always",
printWidth: 80,
},
},
{
files: ["**/.all-contributorsrc"],
options: {
parser: "json-stringify",
singleQuote: false,
},
},
],
};
23 changes: 0 additions & 23 deletions .prettierrc.js

This file was deleted.

Loading
Loading