Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
201 lines
6.2 KiB
JavaScript
201 lines
6.2 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
|
|
import reactPlugin from 'eslint-plugin-react';
|
|
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
|
|
import base from './base.js';
|
|
|
|
const react = {
|
|
files: ['**/*.jsx', '**/*.tsx'],
|
|
rules: {
|
|
'@stylistic/jsx-closing-bracket-location': [
|
|
2,
|
|
{
|
|
location: 'tag-aligned',
|
|
},
|
|
],
|
|
'@stylistic/jsx-curly-spacing': [
|
|
2,
|
|
'never',
|
|
],
|
|
'@stylistic/jsx-equals-spacing': [
|
|
2,
|
|
'never',
|
|
],
|
|
'@stylistic/jsx-first-prop-new-line': [
|
|
2,
|
|
'multiline',
|
|
],
|
|
'@stylistic/jsx-indent-props': [
|
|
2,
|
|
4,
|
|
],
|
|
'@stylistic/jsx-max-props-per-line': [
|
|
2,
|
|
{
|
|
maximum: 1,
|
|
},
|
|
],
|
|
'@stylistic/jsx-pascal-case': 2,
|
|
'@stylistic/jsx-tag-spacing': [
|
|
2,
|
|
{
|
|
closingSlash: 'never',
|
|
beforeSelfClosing: 'never',
|
|
afterOpening: 'never',
|
|
},
|
|
],
|
|
'@stylistic/jsx-wrap-multilines': 2,
|
|
'jsx-a11y/alt-text': 'warn',
|
|
'jsx-a11y/anchor-has-content': 'error',
|
|
'jsx-a11y/anchor-is-valid': 'warn',
|
|
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
'jsx-a11y/aria-props': 'error',
|
|
'jsx-a11y/aria-proptypes': 'error',
|
|
'jsx-a11y/aria-role': 'error',
|
|
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
'jsx-a11y/autocomplete-valid': 'error',
|
|
'jsx-a11y/click-events-have-key-events': 'warn',
|
|
'jsx-a11y/heading-has-content': 'error',
|
|
'jsx-a11y/html-has-lang': 'error',
|
|
'jsx-a11y/iframe-has-title': 'error',
|
|
'jsx-a11y/img-redundant-alt': 'warn',
|
|
'jsx-a11y/interactive-supports-focus': 'warn',
|
|
'jsx-a11y/label-has-associated-control': 'error',
|
|
'jsx-a11y/media-has-caption': 'warn',
|
|
'jsx-a11y/mouse-events-have-key-events': 'off',
|
|
'jsx-a11y/no-access-key': 'error',
|
|
'jsx-a11y/no-aria-hidden-on-focusable': 'error',
|
|
'jsx-a11y/no-autofocus': 'warn',
|
|
'jsx-a11y/no-distracting-elements': 'error',
|
|
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'error',
|
|
'jsx-a11y/no-noninteractive-element-interactions': 'warn',
|
|
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'warn',
|
|
'jsx-a11y/no-noninteractive-tabindex': 'warn',
|
|
'jsx-a11y/no-redundant-roles': 'warn',
|
|
'jsx-a11y/no-static-element-interactions': 'warn',
|
|
'jsx-a11y/role-has-required-aria-props': 'warn',
|
|
'jsx-a11y/role-supports-aria-props': 'warn',
|
|
'jsx-a11y/scope': 'error',
|
|
'jsx-a11y/tabindex-no-positive': 'warn',
|
|
'react/display-name': [
|
|
0,
|
|
{
|
|
ignoreTranspilerName: false,
|
|
},
|
|
],
|
|
'react/forbid-component-props': 0,
|
|
'react/forbid-elements': [
|
|
2,
|
|
{
|
|
forbid: [
|
|
'embed',
|
|
],
|
|
},
|
|
],
|
|
'react/jsx-boolean-value': [
|
|
2,
|
|
'always',
|
|
],
|
|
'react/jsx-filename-extension': [
|
|
2,
|
|
{
|
|
extensions: [
|
|
'.jsx',
|
|
'.tsx',
|
|
],
|
|
},
|
|
],
|
|
'react/jsx-handler-names': 0,
|
|
'react/jsx-key': 2,
|
|
'react/jsx-no-bind': 0,
|
|
'react/jsx-no-comment-textnodes': 2,
|
|
'react/jsx-no-duplicate-props': [
|
|
2,
|
|
{
|
|
ignoreCase: false,
|
|
},
|
|
],
|
|
'react/jsx-no-literals': 2,
|
|
'react/jsx-no-target-blank': 2,
|
|
'react/jsx-no-undef': 2,
|
|
'react/jsx-uses-react': 2,
|
|
'react/jsx-uses-vars': 2,
|
|
'react/no-array-index-key': 1,
|
|
'react/no-children-prop': 2,
|
|
'react/no-danger': 0,
|
|
'react/no-danger-with-children': 2,
|
|
'react/no-deprecated': 1,
|
|
'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': 1,
|
|
'react/no-is-mounted': 2,
|
|
'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,
|
|
{
|
|
ignore: ['mask-type'],
|
|
},
|
|
],
|
|
'react/no-unused-prop-types': [
|
|
1,
|
|
{
|
|
skipShapeProps: true,
|
|
},
|
|
],
|
|
'react/prefer-es6-class': 2,
|
|
'react/prefer-stateless-function': 0,
|
|
'react/prop-types': 2,
|
|
'react/require-default-props': 0,
|
|
'react/require-optimization': 1,
|
|
'react/require-render-return': 2,
|
|
'react/self-closing-comp': 2,
|
|
'react/sort-comp': 0,
|
|
'react/style-prop-object': 2,
|
|
},
|
|
};
|
|
|
|
export default [
|
|
...base,
|
|
jsxA11yPlugin.flatConfigs.recommended,
|
|
reactPlugin.configs.flat.recommended,
|
|
reactHooksPlugin.configs.flat.recommended,
|
|
react,
|
|
{
|
|
|
|
// Disable new rules that are primarily needed to enable React Compiler because we're not using that yet
|
|
rules: {
|
|
'react-hooks/immutability': 0,
|
|
'react-hooks/preserve-manual-memoization': 0,
|
|
'react-hooks/purity': 0,
|
|
'react-hooks/refs': 0,
|
|
'react-hooks/set-state-in-effect': 0,
|
|
|
|
// This rule can be enabled once https://github.com/mattermost/mattermost/pull/36575 is merged because it
|
|
// should be done by converting getChannelIconComponent and getArchiveIconComponent to proper components
|
|
// instead of functions that return component constructors.
|
|
'react-hooks/static-components': 0,
|
|
},
|
|
},
|
|
{
|
|
settings: {
|
|
react: {
|
|
pragma: 'React',
|
|
version: 'detect',
|
|
},
|
|
},
|
|
},
|
|
];
|