Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0e6f229
refactor(prettier): remove dotfiles import, copy over settings
mark-pitblado Sep 10, 2025
bc011e8
docs(pre-commit): add description of what maxpatiiuk pre-commit does
mark-pitblado Sep 11, 2025
c5f646a
refactor(pre-commit): flake8 gitlab -> github
mark-pitblado Sep 11, 2025
55c3cf0
refactor(pre-commit): markdownlint -> markdownlint-cli2
mark-pitblado Sep 11, 2025
b4b88f8
chore(pre-commit): format file
mark-pitblado Sep 11, 2025
386589c
refactor(stylelint): copy rules from maxxxxxxdlp config
mark-pitblado Sep 11, 2025
93816e5
chore(packages): remove maxpatiiuk prettier config
mark-pitblado Sep 11, 2025
3cd841a
chore(eslint): move imported configuration into constants
mark-pitblado Sep 23, 2025
23cac8a
fix(eslint): access array from eslintConfig
mark-pitblado Sep 23, 2025
1239e7f
chore(packages): remove maxxxxxdlp dotfile packages
mark-pitblado Sep 24, 2025
04cc77c
chore(packages): add prettier plugins for package and sh
mark-pitblado Sep 24, 2025
cf8d2da
format(prettier): run prettier with specify config
mark-pitblado Sep 24, 2025
8fb9570
ci(npm): push new lock file so that npm can complete
mark-pitblado Sep 24, 2025
28d7155
Merge branch 'main' into issue-7402
mark-pitblado Sep 24, 2025
0eab890
Lint code with ESLint and Prettier
mark-pitblado Sep 24, 2025
4897d65
chore(packages): add eslint dependencies from max's dotfiles
mark-pitblado Sep 24, 2025
34d5cf6
chore(packages): replace eslint-plugin-markdown with eslint/markdown
mark-pitblado Sep 24, 2025
c030cba
Merge branch 'main' into issue-7402
mark-pitblado Oct 6, 2025
26274ae
Lint code with ESLint and Prettier
mark-pitblado Oct 6, 2025
82ad88e
refactor(eslint): switch to defaults
mark-pitblado Oct 6, 2025
8375f50
Merge branch 'issue-7402' of https://github.com/specify/specify7 into…
mark-pitblado Oct 6, 2025
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
50 changes: 26 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ repos:
pass_filenames: false

- repo: https://github.com/maxpatiiuk/pre-commit
# Prevents a commit if changed files matched one of the regex statements from the blacklist dictionary.
#
# Useful for making sure the following things don't get committed accidentally:
#
# Unresolved #FIX ME comments
# Unresolved merge conflicts (<<<< HEAD)
# Secret keys
# Changes to the config file (`DEVELOPMENT=true)
rev: v1.0.5
hooks:
- id: regex-blacklist
Expand All @@ -32,16 +40,23 @@ repos:
- id: mypy
name: mypy
description: Python mypy typechecker
entry:
/bin/bash -c "docker exec --tty specify7_specify7_1 bash -c
entry: /bin/bash -c "docker exec --tty specify7_specify7_1 bash -c
'VIRTUAL_ENV=./ve make typecheck'"
language: script
types: [python]
pass_filenames: false

#- repo: https://github.com/pre-commit/mirrors-mypy
#- repo: https://github.com/pre-commit/mirrors-eslint
#- repo: https://github.com/awebdeveloper/pre-commit-stylelint
- repo: https://github.com/pycqa/flake8
rev: "3.9.2"
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
args:
# these settings are needed to make flake8 compatible with black
- --max-line-length=88
- --select=C,E,F,W,B,B950
- --extend-ignore=E203,E501

# global hooks:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -63,6 +78,7 @@ repos:
- id: fix-encoding-pragma
- id: forbid-new-submodules

# Spell checker
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
Expand All @@ -77,18 +93,6 @@ repos:
args:
- --line-length=72

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
args:
# these settings are needed to make flake8 compatible with black
- --max-line-length=88
- --select=C,E,F,W,B,B950
- --extend-ignore=E203,E501

- repo: https://github.com/terrencepreilly/darglint
rev: v1.8.1
hooks:
Expand Down Expand Up @@ -117,7 +121,7 @@ repos:
- id: prettier
additional_dependencies:
- [email protected]
- '@prettier/plugin-xml@^0.13.1'
- "@prettier/plugin-xml@^0.13.1"
- prettier-plugin-package@^1.3.0
- prettier-plugin-sh@^0.8.1
- prettier-plugin-tailwind-css@^1.5.0
Expand All @@ -138,13 +142,11 @@ repos:
hooks:
- id: docker-compose-check

- repo: https://github.com/markdownlint/markdownlint
rev: v0.11.0
# Markdown linter
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.18.1
hooks:
- id: markdownlint
files: \.md$
args:
- --git-recurse
- id: markdownlint-cli2

- repo: https://github.com/maxpatiiuk/mirrors-jscpd
rev: v3.3.26
Expand Down
125 changes: 124 additions & 1 deletion specifyweb/frontend/js_src/.stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,131 @@
'use strict';

module.exports = {
extends: '@maxxxxxdlp/stylelint-config',
extends: ['stylelint-config-standard'], // Don't need stylelint-config-prettier after version 15
rules: {
// Some rules are disabled as they conflict with `prettier`
// They should be enabled if you don't use `prettier`

'color-no-invalid-hex': true,
'font-family-no-duplicate-names': true,
'font-family-no-missing-generic-family-keyword': true,
//'named-grid-areas-no-invalid': true, // seems to not exist
'function-calc-no-invalid': true,
'function-calc-no-unspaced-operator': true,
'function-linear-gradient-no-nonstandard-direction': true,
'string-no-newline': true,
'unit-no-unknown': true,
'property-no-unknown': true,
'keyframe-declaration-no-important': true,
'declaration-block-no-duplicate-properties': true,
'declaration-block-no-shorthand-property-overrides': true,
'block-no-empty': true,
'selector-pseudo-class-no-unknown': true,
'selector-pseudo-element-no-unknown': true,
'selector-type-no-unknown': true,
'media-feature-name-no-unknown': true,
'comment-no-empty': true,
'no-descending-specificity': true,
'no-duplicate-at-import-rules': true,
'no-duplicate-selectors': true,
'no-empty-source': true,
//'no-extra-semicolons': true,
'no-invalid-double-slash-comments': true,
'alpha-value-notation': 'number',
'hue-degree-notation': 'angle',
'color-function-notation': 'modern',
'color-named': 'never',
'length-zero-no-unit': true,
'font-weight-notation': 'numeric',
'function-url-scheme-allowed-list': ['https', 'data'],
'keyframes-name-pattern': '[a-z]+(-[a-z]+)*',
'number-max-precision': 2,
'shorthand-property-no-redundant-values': true,
'custom-property-pattern': '[a-z]+(-[a-z]+)*',
'declaration-block-single-line-max-declarations': 1,
'selector-class-pattern': '[a-z]+(-[a-z]+)*',
'selector-id-pattern': '[a-z]+(-[a-z]+)*',
//'selector-max-empty-lines': 0,
'selector-pseudo-element-colon-notation': 'double',
'comment-word-disallowed-list': ['FIXME:'],
'no-unknown-animations': true,
//'color-hex-case': 'lower',
'font-family-name-quotes': 'always-unless-keyword',
//'function-comma-space-after': 'always',
//'function-comma-space-before': 'never',
//'function-max-empty-lines': 0,
'function-name-case': 'lower',
'function-url-quotes': 'always',
'function-whitespace-after': 'always',
//'number-leading-zero': 'always',
//'number-no-trailing-zeros': true,
//'string-quotes': 'double',
//'unit-case': 'lower',
'value-keyword-case': 'lower',
//'value-list-comma-space-after': true,
//'value-list-comma-space-before': false,
//'value-list-max-empty-lines': 0,
'custom-property-empty-line-before': 'never',
//'property-case': 'lower',
'declaration-bang-space-after': 'never',
'declaration-bang-space-before': 'always',
//'declaration-colon-space-after': 'always',
//'declaration-colon-space-before': 'never',
'declaration-empty-line-before': 'never',
//'declaration-block-semicolon-newline-after': 'always',
//'declaration-block-semicolon-newline-before': 'never',
//'declaration-block-semicolon-space-after': 'always-single-line',
//'declaration-block-semicolon-space-before': 'never',
//'declaration-block-trailing-semicolon': 'always',
//'block-closing-brace-newline-after': 'always',
//'block-closing-brace-newline-before': 'always',
//'block-closing-brace-space-after': 'always-single-line',
//'block-closing-brace-space-before': 'always-single-line',
//'block-opening-brace-newline-after': 'always',
//'block-opening-brace-space-after': 'always',
//'block-opening-brace-space-before': 'always-single-line',
'selector-attribute-brackets-space-inside': 'never',
'selector-attribute-operator-space-after': 'never',
'selector-attribute-operator-space-before': 'never',
'selector-attribute-quotes': 'always',
//'selector-combinator-space-after': 'always',
//'selector-combinator-space-before': 'always',
//'selector-descendant-combinator-no-non-space': true,
//'selector-pseudo-class-case': 'lower',
'selector-pseudo-class-parentheses-space-inside': 'never',
//'selector-pseudo-element-case': 'lower',
'selector-type-case': 'lower',
//'selector-list-comma-newline-after': 'always',
//'selector-list-comma-newline-before': 'never-multi-line',
//'selector-list-comma-space-before': 'never',
//'rule-empty-line-before': 'always',
'media-feature-colon-space-after': 'always',
'media-feature-colon-space-before': 'never',
//'media-feature-name-case': 'lower',
'media-feature-parentheses-space-inside': 'never',
'media-feature-range-operator-space-after': 'always',
'media-feature-range-operator-space-before': 'always',
//'media-query-list-comma-newline-after': 'always',
//'media-query-list-comma-newline-before': 'never-multi-line',
//'at-rule-empty-line-before': 'always',
//'at-rule-name-case': 'lower',
//'at-rule-name-newline-after': 'never',
'at-rule-name-space-after': 'always',
//'at-rule-semicolon-newline-after': 'always',
'at-rule-semicolon-space-before': 'never',
'comment-whitespace-inside': 'always',
//'indentation': 2,
//'linebreaks': 'unix',
//'max-empty-lines': 4,
//'max-line-length': [
// 72,
// {
// 'ignore': 'non-comments',
// },
//],
//'no-eol-whitespace': true,
//'no-missing-end-of-source-newline': true,
//'no-empty-first-line': true,
'at-rule-no-unknown': [
true,
{
Expand Down
69 changes: 26 additions & 43 deletions specifyweb/frontend/js_src/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
import eslintConfig from '@maxxxxxdlp/eslint-config';
import eslintConfigReact from '@maxxxxxdlp/eslint-config-react';
import globals from 'globals';

const testFiles = eslintConfig.find(
(rules) =>
typeof rules === 'object' &&
Array.isArray(rules.files) &&
rules.files.join('_').includes('test')
)?.files;
if (testFiles === undefined)
throw new Error('Unable to find test files selector');

const abbreviationsConfig = eslintConfig
.map((rules) =>
typeof rules === 'object' && typeof rules.rules === 'object'
? Object.entries(rules.rules).find(
([name, options]) =>
name === 'unicorn/prevent-abbreviations' && Array.isArray(options)
)?.[1]?.[1]
: undefined
)
.find((options) => typeof options === 'object');
if (abbreviationsConfig === undefined)
throw new Error('Unable to find unicorn/prevent-abbreviations config');
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';

export default [
...eslintConfig,
...eslintConfigReact,
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.{js,jsx,ts,tsx}'],
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin,
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
},
settings: {
react: {
version: 'detect',
},
},
},
{
languageOptions: {
sourceType: 'module',
parserOptions: {
project: './tsconfig.json',
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
Expand All @@ -40,27 +39,11 @@ export default [
},
rules: {
'@typescript-eslint/no-empty-interface': 'off',
'unicorn/prevent-abbreviations': [
'error',
{
...abbreviationsConfig,
allowList: {
...abbreviationsConfig.allowList,
spAppResourceDir: true,
SpAppResourceDir: true,
ScopedAppResourceDir: true,
},
},
],
},
},
{
files: [...testFiles],
files: ['**/*.test.{js,jsx,ts,tsx}', '**/*.spec.{js,jsx,ts,tsx}'],
rules: {
/*
* Tests commonly need to use unusual variable names or mock back-end
* responses, which may include variables in a different naming convention
*/
'@typescript-eslint/naming-convention': 'warn',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ const containsSystemTables = (queryFieldSpec: QueryFieldSpec) => {
return Boolean(baseIsBlocked || pathHasBlockedSystem);
};


const hasHierarchyBaseTable = (queryFieldSpec: QueryFieldSpec) =>
Object.keys(schema.domainLevelIds).includes(
queryFieldSpec.baseTable.name.toLowerCase() as 'collection'
Expand Down
Loading