Revision f2748a6cc37dae520c41e5b54568313dce8fa65c authored by Anders Eknert on 26 October 2023, 07:02:43 UTC, committed by GitHub on 26 October 2023, 07:02:43 UTC
Hello CVAT friends! 👋😃 This PR introduces [Regal](https://github.com/styrainc/regal)) for linting the Rego included in this project. The policy code here is generally in a really good shape, so the linter did not have too much to do. Good work on that! Violations of a few rules were fixed as part of this PR, as they do not change the semantics of evaluation: * [line-length](https://docs.styra.com/regal/rules/style/line-length) * [unconditional-assignment](https://docs.styra.com/regal/rules/style/unconditional-assignment) * [use-assignment-operator](https://docs.styra.com/regal/rules/style/use-assignment-operator) A few other ones were ignored using Regal's configuration file. Whether some of them should be fixed in the future I'll leave up to the project's maintainers. I've also added Regal as a build workflow, along with some documentation. Let me know if I missed anything! Signed-off-by: Anders Eknert <anders@styra.com>
1 parent e0d1343
.eslintrc.js
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
const globalConfig = require('../.eslintrc.js');
const { join } = require('path');
module.exports = {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
ignorePatterns: [
'.eslintrc.js',
'webpack.config.js',
'src/assets/opencv*.js',
'node_modules/**',
'dist/**',
],
extends: ['airbnb-typescript'],
rules: {
...globalConfig.rules, // need to import rules again because they've been redefined by "airbnb-typescript"
'react/no-did-update-set-state': 0, // https://github.com/airbnb/javascript/issues/1875
'react/require-default-props': 'off',
'react/no-unused-prop-types': 'off',
'react/no-array-index-key': 'off',
'react/static-property-placement': ['error', 'static public field'],
'react/jsx-indent': ['warn', 4],
'react/jsx-indent-props': ['warn', 4],
'react/jsx-props-no-spreading': 0,
'jsx-quotes': ['error', 'prefer-single'],
'import/no-extraneous-dependencies': [
'error',
{
packageDir: [__dirname, join(__dirname, '../')]
},
],
},
};
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...