Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
102 changes: 94 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,110 @@ module.exports = {
'sourceType': 'module'
},
'plugins': [
'simple-import-sort',
'react'
],
'ignorePatterns': ['**/static/**/*.js'],
'rules': {
'indent': 'off',
// Disable unused rules
'no-empty-pattern': 'off',
'linebreak-style': [

// Unix linebreaks only
'linebreak-style': ['error', 'unix'],

// Single quotes, allow double to avoid escaping
'quotes': [
'error',
'unix'
'single',
{ 'avoidEscape': true }
],
'quotes': [

// No semicolons
'semi': ['error', 'never'],

// Maximum line length of 120 characters
'max-len': [
'error',
{
'code': 120,
'ignoreUrls': true,
'ignoreRegExpLiterals': true
}
],

// Indent by 2 spaces
'indent': ['error', 2, {
'SwitchCase': 1,
}],

// Import order
'simple-import-sort/imports': ['error', {
groups: [
// external imports in the given order
['^react$', '^prop-types$', '^react', '^[a-z]', '^lodash'],
// rdmo imports: lowercase first, then capitalized components
['^rdmo/.*\\/[a-z]'],
['^rdmo/.*\\/[A-Z]'],
// parent imports: lowercase first, then capitalized components
['^\\.\\..*\\/[a-z]'],
['^\\.\\..*\\/[A-Z]'],
// sibling imports: lowercase first, then capitalized components
['^\\./.*\\/[a-z]'],
['^\\./.*\\/[A-Z]'],
],
}],

// Export order
'simple-import-sort/exports': 'error',

// Disallow newlines between the operands of a ternary expression
'multiline-ternary': ['error', 'never'],

// Ensure spaces after commas
'comma-spacing': ['error', { before: false, after: true }],

// Ensure correct multiline imports
'object-curly-newline': ['error', {
ImportDeclaration: {
multiline: true,
consistent: true
}
}],

// JSX: wrap multiline expressions in parens, opening paren on a new line
'react/jsx-wrap-multilines': [
'error',
'single'
{
'declaration': 'parens-new-line',
'assignment': 'parens-new-line',
'return': 'parens-new-line',
'arrow': 'parens-new-line',
'condition': 'parens-new-line',
'logical': 'parens-new-line',
'prop': 'parens-new-line'
}
],
'semi': [

// JSX curly braces: require newlines inside for multiline expressions
'react/jsx-curly-newline': [
'error',
'never'
]
{
'multiline': 'require',
'singleline': 'consistent'
}
],

// JSX curly brace spacing: no spaces inside { }
'react/jsx-curly-spacing': [
'error',
{
'when': 'never',
'children': true
}
],

// JSX double quotes for props
'jsx-quotes': ['error', 'prefer-double'],
},
'settings': {
'react': {
Expand Down
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"css-loader": "^7.1.1",
"eslint": "~8.56.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"file-loader": "^6.2.0",
"mini-css-extract-plugin": "^2.9.0",
"sass": "^1.94.2",
Expand Down
Loading