Skip to content

Commit

Permalink
Merge branch 'master' into gh-2522
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Nov 17, 2024
2 parents 9a50efa + f80fa59 commit 52aadc5
Show file tree
Hide file tree
Showing 271 changed files with 41,477 additions and 1,451,270 deletions.
264 changes: 259 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,232 @@
const config = require('zotero-plugin/.eslintrc')
const stylistic = require('@stylistic/eslint-plugin').configs.customize({
indent: 2,
quotes: 'single',
})

const config = {
"root": true,
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
'eslint:recommended',
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
'@stylistic',
"eslint-plugin-import",
"eslint-plugin-prefer-arrow",
"@typescript-eslint",
"@typescript-eslint/eslint-plugin",
],
"rules": {
...stylistic.rules,
'@stylistic/semi': [ 'error', 'never' ],
'@stylistic/member-delimiter-style': [ 'error', {
multiline: { delimiter: 'none', requireLast: false },
singleline: { delimiter: 'semi', requireLast: false }
}],
'@stylistic/array-bracket-spacing': ['error', 'always', { singleValue: false }],
'@stylistic/object-curly-spacing': ['error', 'always', { arraysInObjects: false, objectsInObjects: false }],
'@stylistic/new-parens': ['error', 'never'],
'@stylistic/quote-props': [ 'error', 'as-needed' ],
'@stylistic/arrow-parens': [ 'error', 'as-needed' ],
'@stylistic/max-statements-per-line': 'off',

'@typescript-eslint/no-require-imports': 'off',
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": [
"error",
{
"default": "array"
}
],
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/explicit-module-boundary-types": "warn",
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-implied-eval": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-shadow": [
"error",
{
"hoist": "all"
}
],
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-as-const": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/prefer-regexp-exec": "warn",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/restrict-template-expressions": "error",
"@typescript-eslint/triple-slash-reference": [
"error",
{
"path": "always",
"types": "prefer-import",
"lib": "always"
}
],
"@typescript-eslint/unbound-method": "error",
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": "error",
"brace-style": [ "error", "stroustrup", { "allowSingleLine": true } ],
"comma-dangle": [
"error",
{
"objects": "always-multiline",
"arrays": "always-multiline",
"functions": "never"
}
],
"complexity": "off",
"constructor-super": "error",
"curly": [
"error",
"multi-line"
],
"eol-last": "error",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"id-blacklist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined"
],
"id-match": "error",
"import/order": "off",
"linebreak-style": [
"error",
"unix"
],
"max-classes-per-file": [
"error",
4
],
"max-len": [
"warn",
{
"code": 240
}
],
"new-parens": "off",
"no-array-constructor": "off",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "off",
"no-console": "error",
"no-debugger": "error",
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"no-empty-function": "off",
"no-eval": "error",
"no-extra-semi": "off",
"no-fallthrough": "off",
"no-implied-eval": "off",
"no-invalid-this": "off",
"no-irregular-whitespace": "error",
"no-magic-numbers": [
"error",
{
"ignore": [
-1,
0,
1,
2
]
}
],
"no-new-wrappers": "error",
"no-redeclare": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-underscore-dangle": "error",
"no-unsafe-finally": "error",
"no-unused-labels": "error",
"no-unused-vars": "off",
"no-var": "error",
"object-shorthand": "error",
"one-var": [ "off", "never" ],
'prefer-arrow/prefer-arrow-functions': 'off',
"prefer-const": [ "error", { "destructuring": "all" } ],
"prefer-object-spread": "error",
"prefer-template": "error",
"radix": "off",
"require-await": "off",
"@stylistic/space-before-function-paren": [
"error",
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"spaced-comment": [
"error",
"always",
{
"markers": [
"/"
]
}
],
"use-isnan": "error",
"valid-typeof": "off",
"yoda": "error",
"@typescript-eslint/prefer-regexp-exec": "off"
}
}

Object.assign(config.rules, {
'max-classes-per-file': 'off',
Expand All @@ -7,6 +235,10 @@ Object.assign(config.rules, {
'no-underscore-dangle': [ 'error', { "allowAfterThis": true } ],
'prefer-template': 'off',

// '@stylistic/js/operator-linebreak': ['error', 'before' ],

'prefer-arrow/prefer-arrow-functions': 'off',

'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
Expand All @@ -19,18 +251,40 @@ Object.assign(config.rules, {
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/prefer-regexp-exec': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/array-type': 'off',

'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/member-delimiter-style': [ 'error', {
multiline: { delimiter: 'none', requireLast: false },
singleline: { delimiter: 'comma', requireLast: false },
}],
'@typescript-eslint/no-unused-vars': [ 'error', { "argsIgnorePattern": "^_" } ],
'no-magic-numbers': 'off',
'max-len': [ 'warn', { code: 320 } ],
'prefer-arrow/prefer-arrow-functions': 'off',

'@stylistic/array-bracket-spacing': 'off',
'@stylistic/template-curly-spacing': 'off',
'@stylistic/quotes': ['error', 'single', { "avoidEscape": true }],
'@stylistic/lines-between-class-members': 'off',
})

const shell = require('shelljs')
const branch = (process.env.GITHUB_REF && process.env.GITHUB_REF.startsWith('refs/heads/'))
? process.env.GITHUB_REF.replace('refs/heads/', '')
: shell.exec('git rev-parse --abbrev-ref HEAD', { silent: true }).stdout.trim()
const no_restricted_syntax = {master: 'error', minlog: 'warn'}[branch] || 'off'
config.rules['no-restricted-syntax'] = [
{master: 'error'}[branch] || 'off',
{ selector: "CallExpression[callee.name='dump']", message: 'use of dump is not allowed' },
{ selector: "CallExpression[callee.object.name='Zotero'][callee.property.name='debug']", message: 'use of Zotero.debug is not allowed' },
{ selector: "CallExpression[callee.object.name='Zotero'][callee.property.name='logError']", message: 'use of Zotero.logError is not allowed' },
{ selector: "CallExpression[callee.object.name='log'][callee.property.name='debug']", message: 'use of log.debug is not allowed' },
{ selector: "CallExpression[callee.object.name='log'][callee.property.name='dump']", message: 'use of log.dump is not allowed' },
{ selector: "CallExpression[callee.name='trace']", message: 'use of trace is not allowed' },
]

config.ignorePatterns = [
'gen/**/*.ts',
'gen/**/*.js',
'setup/**/*.ts',
'setup/**/*.js',
'util/*.ts',
'minitests/*.ts',
'content/minitests/*.ts',
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock.json -diff
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body:
"N/A" is usually inaccurate (for bugs and feature requests alike); if you're unsure of its relevance, please generate one anyway. When you omit it, the issue bot will guide you on creating a debug log ID. Please carefully review that message. If you genuinely believe it doesn't apply, kindly explain why. Your cooperation is appreciated.
If the regular debug log submission does not work, use "send to file.io" from the help menu.
*If the regular debug log submission does not work, use "send to file.io" from the help menu.*
If you are sure your question does not relate to items in your library at all, just select any one item in your library.
- type: input
Expand Down
31 changes: 19 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,30 @@ jobs:
- name: install node packages
run: npm install

- name: set slow and beta flags
- name: set slow/legacy/beta flags
run: ./util/action-flags
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: ./util/action-flags

- name: get previous test durations
run: curl -L
https://github.com/retorquere/zotero-better-bibtex/releases/download/builds/durations${{
env.slow }}.json --create-dirs -o test/balance/durations.json

- name: balance tests
id: balance
run: ./util/balance.py --durations test/balance/durations.json --bins test/balance/bins.json
--minutes 10 ${{ env.slow }} ${{ env.beta }}
--minutes 10 ${{ env.slow }} ${{ env.beta }} ${{ env.legacy }}

- name: build ${{ env.beta }} ${{ env.legacy }}
run: npm run build
env:
VERSION_WITH_ISSUE: false

- name: build ${{ env.beta }}
run: npm run build ${{ env.beta }}
- name: publish debug bridge
run: ./util/publish-debug-bridge.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: store build artifacts
uses: actions/upload-artifact@v4
Expand All @@ -95,7 +103,7 @@ jobs:
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' ||
startsWith(github.ref, 'refs/tags/')) }}
- name: deploy site
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' ||
startsWith(github.ref, 'refs/tags/')) }}
with:
Expand All @@ -112,10 +120,6 @@ jobs:
bin: ${{ fromJSON(needs.build.outputs.bin_ids) }}
client: ${{ fromJSON(needs.build.outputs.clients) }}
worker: [--worker, --no-worker]
exclude:
- client: jurism-beta
- client: jurism
# worker: '--worker'
steps:
- uses: actions/checkout@v4
- name: fetch build artifacts
Expand Down Expand Up @@ -174,13 +178,16 @@ jobs:
run: |
touch ~/.BBTTEST.log
cp ~/.BBTTEST.log ~/BBTTEST--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker }}.txt
cp -r ~/.BBTTEST ~/BBTTEST
- name: upload log on failure
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v4
with:
name: debug-log--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker
}}
path: ~/BBTTEST*.txt
path: |
~/BBTTEST*.txt
exported/
retention-days: 5

- name: store test artifacts
Expand Down Expand Up @@ -242,7 +249,7 @@ jobs:
- run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/github-script@v6
- uses: actions/github-script@v7
continue-on-error: true
with:
script: |
Expand Down
Loading

0 comments on commit 52aadc5

Please sign in to comment.