Skip to content

Commit

Permalink
Add two eslint plugins (#24776)
Browse files Browse the repository at this point in the history
Add these two plugins and autofix issues:

-
[eslint-plugin-no-use-extend-native](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native)
-
[eslint-plugin-array-func](https://github.com/freaktechnik/eslint-plugin-array-func)
  • Loading branch information
silverwind authored May 18, 2023
1 parent 71451ab commit 4aacc3a
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ parserOptions:

plugins:
- "@eslint-community/eslint-plugin-eslint-comments"
- eslint-plugin-array-func
- eslint-plugin-custom-elements
- eslint-plugin-import
- eslint-plugin-jquery
- eslint-plugin-no-jquery
- eslint-plugin-no-use-extend-native
- eslint-plugin-regexp
- eslint-plugin-sonarjs
- eslint-plugin-unicorn
Expand Down Expand Up @@ -59,6 +61,12 @@ rules:
array-bracket-spacing: [2, never]
array-callback-return: [2, {checkForEach: true}]
array-element-newline: [0]
array-func/avoid-reverse: [2]
array-func/from-map: [2]
array-func/no-unnecessary-this-arg: [2]
array-func/prefer-array-from: [2]
array-func/prefer-flat-map: [0] # handled by unicorn/prefer-array-flat-map
array-func/prefer-flat: [0] # handled by unicorn/prefer-array-flat
arrow-body-style: [0]
arrow-parens: [2, always]
arrow-spacing: [2, {before: true, after: true}]
Expand Down Expand Up @@ -444,6 +452,7 @@ rules:
no-unused-private-class-members: [2]
no-unused-vars: [2, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, caughtErrorsIgnorePattern: ^_, destructuredArrayIgnorePattern: ^_, ignoreRestSiblings: false}]
no-use-before-define: [2, {functions: false, classes: true, variables: true, allowNamedExports: true}]
no-use-extend-native/no-use-extend-native: [2]
no-useless-backreference: [2]
no-useless-call: [2]
no-useless-catch: [2]
Expand Down
113 changes: 113 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@
"@stoplight/spectral-cli": "6.6.0",
"@vitejs/plugin-vue": "4.2.3",
"eslint": "8.40.0",
"eslint-plugin-array-func": "3.1.8",
"eslint-plugin-custom-elements": "0.0.8",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jquery": "1.5.1",
"eslint-plugin-no-jquery": "2.7.0",
"eslint-plugin-no-use-extend-native": "0.5.0",
"eslint-plugin-regexp": "1.15.0",
"eslint-plugin-sonarjs": "0.19.0",
"eslint-plugin-unicorn": "47.0.0",
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/features/copycontent.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function initCopyContent() {
}
} else { // text, read from DOM
const lineEls = document.querySelectorAll('.file-view .lines-code');
content = Array.from(lineEls).map((el) => el.textContent).join('');
content = Array.from(lineEls, (el) => el.textContent).join('');
}

// try copy original first, if that fails and it's an image, convert it to png
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/features/repo-projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function moveIssue({item, from, to, oldIndex}) {
updateIssueCount(to);

const columnSorting = {
issues: [...columnCards].map((card, i) => ({
issues: Array.from(columnCards, (card, i) => ({
issueID: parseInt($(card).attr('data-issue')),
sorting: i
}))
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/utils/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import emojis from '../../../assets/emoji.json';
const maxMatches = 6;

function sortAndReduce(map) {
const sortedMap = new Map([...map.entries()].sort((a, b) => a[1] - b[1]));
const sortedMap = new Map(Array.from(map.entries()).sort((a, b) => a[1] - b[1]));
return Array.from(sortedMap.keys()).slice(0, maxMatches);
}

Expand Down

0 comments on commit 4aacc3a

Please sign in to comment.