diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6ecdc84..589d3cd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,18 +15,18 @@ jobs: - uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6 - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4 with: - cache: "npm" - node-version-file: ".nvmrc" + cache: 'npm' + node-version-file: '.nvmrc' - name: Info run: | - cat < message.startsWith('chore(release):')] -}; + extends: ['@commitlint/config-conventional'], + ignores: [message => message.startsWith('chore(release):')], +} diff --git a/eslint.config.mjs b/eslint.config.mjs index f8a50e4..0f3a89b 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,3 +1,3 @@ -import defaults from './lib/index.mjs'; +import defaults from './lib/index.mjs' -export default defaults; +export default defaults diff --git a/lib/index.mjs b/lib/index.mjs index 9b72838..e535fcd 100644 --- a/lib/index.mjs +++ b/lib/index.mjs @@ -1,11 +1,10 @@ - -import eslintConfigPrettier from 'eslint-config-prettier/flat'; +import eslintConfigPrettier from 'eslint-config-prettier/flat' /** * @type {import('eslint').Linter.Config[]} */ const eslintConfigScratch = [ - eslintConfigPrettier, // keep this last to turn off rules that conflict with Prettier -]; + eslintConfigPrettier, // keep this last to turn off rules that conflict with Prettier +] -export default eslintConfigScratch; +export default eslintConfigScratch diff --git a/lib/legacy/index.mjs b/lib/legacy/index.mjs index 5c6951e..98d23d3 100644 --- a/lib/legacy/index.mjs +++ b/lib/legacy/index.mjs @@ -1,164 +1,192 @@ -import globals from 'globals'; -import babelParser from '@babel/eslint-parser'; -import path from 'node:path'; -import {fileURLToPath} from 'node:url'; -import js from '@eslint/js'; -import {FlatCompat} from '@eslint/eslintrc'; -import jsdoc from 'eslint-plugin-jsdoc'; +import jsdoc from 'eslint-plugin-jsdoc' +import globals from 'globals' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import babelParser from '@babel/eslint-parser' +import { FlatCompat } from '@eslint/eslintrc' +import js from '@eslint/js' -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all -}); + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}) export default [ - ...compat.extends('eslint:recommended'), - jsdoc.configs['flat/recommended'], - { - languageOptions: { - globals: { - ...globals.commonjs - }, + ...compat.extends('eslint:recommended'), + jsdoc.configs['flat/recommended'], + { + languageOptions: { + globals: { + ...globals.commonjs, + }, - parser: babelParser, - ecmaVersion: 6, - sourceType: 'script', + parser: babelParser, + ecmaVersion: 6, + sourceType: 'script', - parserOptions: { - requireConfigFile: false - } + parserOptions: { + requireConfigFile: false, + }, + }, + + rules: { + 'array-callback-return': [2], + 'block-scoped-var': [2], + curly: [2, 'multi-line'], + 'dot-location': [2, 'property'], + 'dot-notation': [2], + eqeqeq: [2], + 'no-alert': [2], + 'no-div-regex': [2], + 'no-else-return': [2], + 'no-eq-null': [2], + 'no-eval': [2], + 'no-extend-native': [2], + 'no-extra-bind': [2], + 'no-global-assign': [2], + 'no-implied-eval': [2], + 'no-invalid-this': [2], + 'no-iterator': [2], + 'no-lone-blocks': [2], + 'no-loop-func': [2], + 'no-multi-spaces': [2], + 'no-multi-str': [2], + 'no-new': [2], + 'no-proto': [2], + 'no-return-assign': [2], + 'no-script-url': [2], + 'no-self-compare': [2], + 'no-sequences': [2], + 'no-throw-literal': [2], + 'no-unmodified-loop-condition': [2], + 'no-unused-expressions': [2], + 'no-useless-call': [2], + 'no-useless-concat': [2], + 'no-useless-escape': [2], + 'no-warning-comments': [0], + 'no-with': [2], + radix: [2], + 'wrap-iife': [2], + yoda: [2], + + 'no-unused-vars': [ + 2, + { + args: 'after-used', + varsIgnorePattern: '^_', }, + ], - rules: { - 'array-callback-return': [2], - 'block-scoped-var': [2], - 'curly': [2, 'multi-line'], - 'dot-location': [2, 'property'], - 'dot-notation': [2], - 'eqeqeq': [2], - 'no-alert': [2], - 'no-div-regex': [2], - 'no-else-return': [2], - 'no-eq-null': [2], - 'no-eval': [2], - 'no-extend-native': [2], - 'no-extra-bind': [2], - 'no-global-assign': [2], - 'no-implied-eval': [2], - 'no-invalid-this': [2], - 'no-iterator': [2], - 'no-lone-blocks': [2], - 'no-loop-func': [2], - 'no-multi-spaces': [2], - 'no-multi-str': [2], - 'no-new': [2], - 'no-proto': [2], - 'no-return-assign': [2], - 'no-script-url': [2], - 'no-self-compare': [2], - 'no-sequences': [2], - 'no-throw-literal': [2], - 'no-unmodified-loop-condition': [2], - 'no-unused-expressions': [2], - 'no-useless-call': [2], - 'no-useless-concat': [2], - 'no-useless-escape': [2], - 'no-warning-comments': [0], - 'no-with': [2], - 'radix': [2], - 'wrap-iife': [2], - 'yoda': [2], + 'no-catch-shadow': [2], + 'no-shadow': [2], + 'no-undefined': [2], + 'no-use-before-define': [2], + strict: [2, 'never'], + 'array-bracket-spacing': [2, 'never'], + 'block-spacing': [2, 'always'], + 'brace-style': [2], - 'no-unused-vars': [2, { - args: 'after-used', - varsIgnorePattern: '^_' - }], + camelcase: [ + 2, + { + properties: 'never', + }, + ], - 'no-catch-shadow': [2], - 'no-shadow': [2], - 'no-undefined': [2], - 'no-use-before-define': [2], - 'strict': [2, 'never'], - 'array-bracket-spacing': [2, 'never'], - 'block-spacing': [2, 'always'], - 'brace-style': [2], + 'comma-dangle': [2, 'never'], + 'comma-spacing': [2], + 'comma-style': [2], + 'eol-last': [2, 'always'], + 'func-call-spacing': [2, 'never'], + 'func-style': [2, 'expression'], + indent: [2, 4], + 'jsx-quotes': [2, 'prefer-double'], - 'camelcase': [2, { - properties: 'never' - }], + 'key-spacing': [ + 2, + { + beforeColon: false, + afterColon: true, + mode: 'strict', + }, + ], - 'comma-dangle': [2, 'never'], - 'comma-spacing': [2], - 'comma-style': [2], - 'eol-last': [2, 'always'], - 'func-call-spacing': [2, 'never'], - 'func-style': [2, 'expression'], - 'indent': [2, 4], - 'jsx-quotes': [2, 'prefer-double'], + 'keyword-spacing': [ + 2, + { + before: true, + after: true, + }, + ], - 'key-spacing': [2, { - beforeColon: false, - afterColon: true, - mode: 'strict' - }], + 'linebreak-style': [2, 'unix'], - 'keyword-spacing': [2, { - before: true, - after: true - }], + 'max-len': [ + 2, + { + code: 120, + tabWidth: 4, + ignoreUrls: true, + }, + ], - 'linebreak-style': [2, 'unix'], + 'new-parens': [2], + 'newline-per-chained-call': [2], + 'no-lonely-if': [2], + 'no-mixed-operators': [2], - 'max-len': [2, { - code: 120, - tabWidth: 4, - ignoreUrls: true - }], + 'no-multiple-empty-lines': [ + 2, + { + max: 2, + maxBOF: 0, + maxEOF: 0, + }, + ], - 'new-parens': [2], - 'newline-per-chained-call': [2], - 'no-lonely-if': [2], - 'no-mixed-operators': [2], + 'no-negated-condition': [2], + 'no-tabs': [2], - 'no-multiple-empty-lines': [2, { - max: 2, - maxBOF: 0, - maxEOF: 0 - }], + 'no-trailing-spaces': [ + 2, + { + skipBlankLines: true, + }, + ], - 'no-negated-condition': [2], - 'no-tabs': [2], + 'no-unneeded-ternary': [2], + 'object-curly-spacing': [2], - 'no-trailing-spaces': [2, { - skipBlankLines: true - }], + 'object-property-newline': [ + 2, + { + allowMultiplePropertiesPerLine: true, + }, + ], - 'no-unneeded-ternary': [2], - 'object-curly-spacing': [2], + 'one-var': [2, 'never'], + 'operator-linebreak': [2, 'after'], + 'quote-props': [2, 'consistent-as-needed'], - 'object-property-newline': [2, { - allowMultiplePropertiesPerLine: true - }], + quotes: [ + 2, + 'single', + { + allowTemplateLiterals: true, + avoidEscape: true, + }, + ], - 'one-var': [2, 'never'], - 'operator-linebreak': [2, 'after'], - 'quote-props': [2, 'consistent-as-needed'], - - 'quotes': [2, 'single', { - allowTemplateLiterals: true, - avoidEscape: true - }], - - 'semi': [2, 'always'], - 'semi-spacing': [2], - 'space-before-function-paren': [2, 'always'], - 'space-in-parens': [2], - 'space-infix-ops': [2], - 'space-unary-ops': [2], - 'spaced-comment': [2] - } - } -]; + semi: [2, 'always'], + 'semi-spacing': [2], + 'space-before-function-paren': [2, 'always'], + 'space-in-parens': [2], + 'space-infix-ops': [2], + 'space-unary-ops': [2], + 'spaced-comment': [2], + }, + }, +] diff --git a/lib/legacy/node.mjs b/lib/legacy/node.mjs index 3632d0e..c4458d7 100644 --- a/lib/legacy/node.mjs +++ b/lib/legacy/node.mjs @@ -1,17 +1,19 @@ -import globals from 'globals'; +import globals from 'globals' -export default [{ +export default [ + { languageOptions: { - globals: { - ...globals.node - } + globals: { + ...globals.node, + }, }, rules: { - 'global-require': [2], - 'handle-callback-err': [2], - 'no-mixed-requires': [2], - 'no-new-require': [2], - 'no-path-concat': [2] - } -}]; + 'global-require': [2], + 'handle-callback-err': [2], + 'no-mixed-requires': [2], + 'no-new-require': [2], + 'no-path-concat': [2], + }, + }, +] diff --git a/lib/legacy/react.mjs b/lib/legacy/react.mjs index c2f7106..261e70a 100644 --- a/lib/legacy/react.mjs +++ b/lib/legacy/react.mjs @@ -1,85 +1,100 @@ -import react from 'eslint-plugin-react'; -import path from 'node:path'; -import {fileURLToPath} from 'node:url'; -import js from '@eslint/js'; -import {FlatCompat} from '@eslint/eslintrc'; +import react from 'eslint-plugin-react' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import { FlatCompat } from '@eslint/eslintrc' +import js from '@eslint/js' -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all -}); + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}) -export default [...compat.extends('plugin:react/recommended'), { +export default [ + ...compat.extends('plugin:react/recommended'), + { plugins: { - react + react, }, rules: { - 'react/display-name': [2], - 'react/forbid-prop-types': [2], - 'react/no-children-prop': [2], - 'react/no-danger': [2], - 'react/no-danger-with-children': [2], - 'react/no-deprecated': [2], - 'react/no-did-mount-set-state': [2], - 'react/no-did-update-set-state': [2], - 'react/no-direct-mutation-state': [2], - 'react/no-find-dom-node': [2], - 'react/no-is-mounted': [2], + 'react/display-name': [2], + 'react/forbid-prop-types': [2], + 'react/no-children-prop': [2], + 'react/no-danger': [2], + 'react/no-danger-with-children': [2], + 'react/no-deprecated': [2], + 'react/no-did-mount-set-state': [2], + 'react/no-did-update-set-state': [2], + 'react/no-direct-mutation-state': [2], + 'react/no-find-dom-node': [2], + 'react/no-is-mounted': [2], - 'react/no-multi-comp': [2, { - ignoreStateless: true - }], + 'react/no-multi-comp': [ + 2, + { + ignoreStateless: true, + }, + ], - 'react/no-render-return-value': [2], - 'react/no-set-state': [0], - 'react/no-string-refs': [2], - 'react/no-unescaped-entities': [2], - 'react/no-unknown-property': [2], - 'react/no-unused-prop-types': [2], - 'react/prefer-es6-class': [2], - 'react/prefer-stateless-function': [2], - 'react/prop-types': [2], - 'react/react-in-jsx-scope': [2], - 'react/require-optimization': [0], - 'react/require-render-return': [2], - 'react/self-closing-comp': [2], - 'react/sort-comp': [2], - 'react/style-prop-object': [2], - 'react/jsx-boolean-value': [2, 'never'], - 'react/jsx-closing-bracket-location': [2, 'line-aligned'], - 'react/jsx-curly-spacing': [2], - 'react/jsx-equals-spacing': [2], - 'react/jsx-filename-extension': [2], - 'react/jsx-first-prop-new-line': [2, 'multiline'], - 'react/jsx-handler-names': [2], - 'react/jsx-indent': [2], - 'react/jsx-indent-props': [2], - 'react/jsx-key': [2], + 'react/no-render-return-value': [2], + 'react/no-set-state': [0], + 'react/no-string-refs': [2], + 'react/no-unescaped-entities': [2], + 'react/no-unknown-property': [2], + 'react/no-unused-prop-types': [2], + 'react/prefer-es6-class': [2], + 'react/prefer-stateless-function': [2], + 'react/prop-types': [2], + 'react/react-in-jsx-scope': [2], + 'react/require-optimization': [0], + 'react/require-render-return': [2], + 'react/self-closing-comp': [2], + 'react/sort-comp': [2], + 'react/style-prop-object': [2], + 'react/jsx-boolean-value': [2, 'never'], + 'react/jsx-closing-bracket-location': [2, 'line-aligned'], + 'react/jsx-curly-spacing': [2], + 'react/jsx-equals-spacing': [2], + 'react/jsx-filename-extension': [2], + 'react/jsx-first-prop-new-line': [2, 'multiline'], + 'react/jsx-handler-names': [2], + 'react/jsx-indent': [2], + 'react/jsx-indent-props': [2], + 'react/jsx-key': [2], - 'react/jsx-max-props-per-line': [2, { - maximum: 1 - }], + 'react/jsx-max-props-per-line': [ + 2, + { + maximum: 1, + }, + ], - 'react/jsx-no-bind': [2, { - ignoreRefs: true - }], + 'react/jsx-no-bind': [ + 2, + { + ignoreRefs: true, + }, + ], - 'react/jsx-no-comment-textnodes': [2], - 'react/jsx-no-duplicate-props': [2], - 'react/jsx-no-target-blank': [2], - 'react/jsx-no-undef': [2], + 'react/jsx-no-comment-textnodes': [2], + 'react/jsx-no-duplicate-props': [2], + 'react/jsx-no-target-blank': [2], + 'react/jsx-no-undef': [2], - 'react/jsx-pascal-case': [2, { - allowAllCaps: true - }], + 'react/jsx-pascal-case': [ + 2, + { + allowAllCaps: true, + }, + ], - 'react/jsx-tag-spacing': [2], - 'react/jsx-uses-react': [2], - 'react/jsx-uses-vars': [2], - 'react/jsx-wrap-multilines': [2] - } -}]; + 'react/jsx-tag-spacing': [2], + 'react/jsx-uses-react': [2], + 'react/jsx-uses-vars': [2], + 'react/jsx-wrap-multilines': [2], + }, + }, +] diff --git a/lib/legacy/web.mjs b/lib/legacy/web.mjs index 28750f0..58a3ad3 100644 --- a/lib/legacy/web.mjs +++ b/lib/legacy/web.mjs @@ -1,42 +1,50 @@ -export default [{ +export default [ + { languageOptions: { - globals: {}, - ecmaVersion: 2018, - sourceType: 'script' + globals: {}, + ecmaVersion: 2018, + sourceType: 'script', }, rules: { - 'arrow-body-style': [2, 'as-needed'], - 'arrow-parens': [2, 'as-needed'], + 'arrow-body-style': [2, 'as-needed'], + 'arrow-parens': [2, 'as-needed'], - 'arrow-spacing': [2, { - before: true, - after: true - }], + 'arrow-spacing': [ + 2, + { + before: true, + after: true, + }, + ], - 'no-prototype-builtins': [2], - 'no-confusing-arrow': [2], - 'no-duplicate-imports': [2], - 'no-return-await': [2], - 'no-template-curly-in-string': [2], - 'no-useless-computed-key': [2], - 'no-useless-constructor': [2], - 'no-useless-rename': [2], - 'no-var': [2], - 'prefer-arrow-callback': [2], + 'no-prototype-builtins': [2], + 'no-confusing-arrow': [2], + 'no-duplicate-imports': [2], + 'no-return-await': [2], + 'no-template-curly-in-string': [2], + 'no-useless-computed-key': [2], + 'no-useless-constructor': [2], + 'no-useless-rename': [2], + 'no-var': [2], + 'prefer-arrow-callback': [2], - 'prefer-const': [2, { - destructuring: 'all' - }], + 'prefer-const': [ + 2, + { + destructuring: 'all', + }, + ], - 'prefer-promise-reject-errors': [2], - 'prefer-rest-params': [2], - 'prefer-spread': [2], - 'prefer-template': [2], - 'require-atomic-updates': [2], - 'require-await': [2], - 'rest-spread-spacing': [2, 'never'], - 'symbol-description': [2], - 'template-curly-spacing': [2, 'never'] - } -}]; + 'prefer-promise-reject-errors': [2], + 'prefer-rest-params': [2], + 'prefer-spread': [2], + 'prefer-template': [2], + 'require-atomic-updates': [2], + 'require-await': [2], + 'rest-spread-spacing': [2, 'never'], + 'symbol-description': [2], + 'template-curly-spacing': [2, 'never'], + }, + }, +] diff --git a/prettier.config.mjs b/prettier.config.mjs index 6e958b6..1cd84f4 100644 --- a/prettier.config.mjs +++ b/prettier.config.mjs @@ -1,27 +1,25 @@ -import sortImports from '@trivago/prettier-plugin-sort-imports'; +import sortImports from '@trivago/prettier-plugin-sort-imports' /** * @see https://prettier.io/docs/configuration * @type {import("prettier").Config} */ const prettierConfig = { - // #region Prettier - arrowParens: 'avoid', - bracketSameLine: false, - bracketSpacing: true, - plugins: [ - sortImports - ], - printWidth: 118, - semi: false, - singleQuote: true, - tabWidth: 2, - trailingComma: 'all', - // #endregion Prettier + // #region Prettier + arrowParens: 'avoid', + bracketSameLine: false, + bracketSpacing: true, + plugins: [sortImports], + printWidth: 118, + semi: false, + singleQuote: true, + tabWidth: 2, + trailingComma: 'all', + // #endregion Prettier - // #region @trivago/prettier-plugin-sort-imports - importOrder: ['^@', '^[./]'] - // #endregion @trivago/prettier-plugin-sort-imports -}; + // #region @trivago/prettier-plugin-sort-imports + importOrder: ['^@', '^[./]'], + // #endregion @trivago/prettier-plugin-sort-imports +} -export default prettierConfig; +export default prettierConfig diff --git a/release.config.js b/release.config.js index a900fd4..1deeca3 100644 --- a/release.config.js +++ b/release.config.js @@ -1,9 +1,9 @@ module.exports = { - extends: 'scratch-semantic-release-config', - branches: [ - { - name: 'master' - // default channel - } - ] -}; + extends: 'scratch-semantic-release-config', + branches: [ + { + name: 'master', + // default channel + }, + ], +} diff --git a/renovate.json5 b/renovate.json5 index 087d54e..380a201 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -1,7 +1,5 @@ { - "$schema": "https://docs.renovatebot.com/renovate-schema.json", + $schema: 'https://docs.renovatebot.com/renovate-schema.json', - "extends": [ - "github>scratchfoundation/scratch-renovate-config:js-lib" - ] + extends: ['github>scratchfoundation/scratch-renovate-config:js-lib'], }