Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
81e82875
Commit
81e82875
authored
Dec 23, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run prettier on 15 files - 4 of 73
Part of our prettier migration; changing the arrow-parens style.
parent
dc6c2412
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
44 additions
and
61 deletions
+44
-61
.prettierignore
.prettierignore
+0
-17
app/assets/javascripts/access_tokens/index.js
app/assets/javascripts/access_tokens/index.js
+1
-1
app/assets/javascripts/activities.js
app/assets/javascripts/activities.js
+3
-3
app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue
...ts_modal/components/add_context_commits_modal_wrapper.vue
+5
-5
app/assets/javascripts/add_context_commits_modal/store/actions.js
...ts/javascripts/add_context_commits_modal/store/actions.js
+7
-7
jest.config.base.js
jest.config.base.js
+2
-2
jest.config.js
jest.config.js
+1
-1
scripts/frontend/block_dependencies.js
scripts/frontend/block_dependencies.js
+2
-2
scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js
.../frontend/check_page_bundle_mixins_css_for_sideeffects.js
+1
-1
scripts/frontend/extract_gettext_all.js
scripts/frontend/extract_gettext_all.js
+1
-1
scripts/frontend/file_test_coverage.js
scripts/frontend/file_test_coverage.js
+8
-8
scripts/frontend/frontend_script_utils.js
scripts/frontend/frontend_script_utils.js
+2
-2
scripts/frontend/merge_coverage_frontend.js
scripts/frontend/merge_coverage_frontend.js
+4
-4
scripts/frontend/prettier.js
scripts/frontend/prettier.js
+5
-5
scripts/frontend/stylelint/stylelint-utility-map.js
scripts/frontend/stylelint/stylelint-utility-map.js
+1
-1
scripts/frontend/stylelint/stylelint-utils.js
scripts/frontend/stylelint/stylelint-utils.js
+1
-1
No files found.
.prettierignore
View file @
81e82875
...
...
@@ -10,23 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.scss
*.md
## boring-bohr
jest.config.base.js
jest.config.js
scripts/frontend/block_dependencies.js
scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js
scripts/frontend/extract_gettext_all.js
scripts/frontend/file_test_coverage.js
scripts/frontend/frontend_script_utils.js
scripts/frontend/merge_coverage_frontend.js
scripts/frontend/prettier.js
scripts/frontend/stylelint/stylelint-utility-map.js
scripts/frontend/stylelint/stylelint-utils.js
app/assets/javascripts/access_tokens/index.js
app/assets/javascripts/activities.js
app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue
app/assets/javascripts/add_context_commits_modal/store/actions.js
## interesting-kepler
app/assets/javascripts/add_context_commits_modal/utils.js
app/assets/javascripts/admin/application_settings/setup_metrics_and_profiling.js
...
...
app/assets/javascripts/access_tokens/index.js
View file @
81e82875
import
Vue
from
'
vue
'
;
import
ExpiresAtField
from
'
./components/expires_at_field.vue
'
;
const
getInputAttrs
=
el
=>
{
const
getInputAttrs
=
(
el
)
=>
{
const
input
=
el
.
querySelector
(
'
input
'
);
return
{
...
...
app/assets/javascripts/activities.js
View file @
81e82875
...
...
@@ -9,9 +9,9 @@ export default class Activities {
constructor
(
container
=
''
)
{
this
.
container
=
container
;
Pager
.
init
(
20
,
true
,
false
,
data
=>
data
,
this
.
updateTooltips
,
this
.
container
);
Pager
.
init
(
20
,
true
,
false
,
(
data
)
=>
data
,
this
.
updateTooltips
,
this
.
container
);
$
(
'
.event-filter-link
'
).
on
(
'
click
'
,
e
=>
{
$
(
'
.event-filter-link
'
).
on
(
'
click
'
,
(
e
)
=>
{
e
.
preventDefault
();
this
.
toggleFilter
(
e
.
currentTarget
);
this
.
reloadActivities
();
...
...
@@ -24,7 +24,7 @@ export default class Activities {
reloadActivities
()
{
$
(
'
.content_list
'
).
html
(
''
);
Pager
.
init
(
20
,
true
,
false
,
data
=>
data
,
this
.
updateTooltips
,
this
.
container
);
Pager
.
init
(
20
,
true
,
false
,
(
data
)
=>
data
,
this
.
updateTooltips
,
this
.
container
);
}
toggleFilter
(
sender
)
{
...
...
app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue
View file @
81e82875
...
...
@@ -61,14 +61,14 @@ export default {
},
},
selectedCommitsCount
()
{
return
this
.
selectedCommits
.
filter
(
selectedCommit
=>
selectedCommit
.
isSelected
).
length
;
return
this
.
selectedCommits
.
filter
(
(
selectedCommit
)
=>
selectedCommit
.
isSelected
).
length
;
},
shouldPurge
()
{
return
this
.
selectedCommitsCount
!==
this
.
selectedCommits
.
length
;
},
uniqueCommits
()
{
return
this
.
selectedCommits
.
filter
(
selectedCommit
=>
(
selectedCommit
)
=>
selectedCommit
.
isSelected
&&
findCommitIndex
(
this
.
contextCommits
,
selectedCommit
.
short_id
)
===
-
1
,
);
...
...
@@ -126,7 +126,7 @@ export default {
this
.
focusSearch
();
if
(
this
.
shouldPurge
)
{
this
.
setSelectedCommits
(
[...
this
.
commits
,
...
this
.
selectedCommits
].
filter
(
commit
=>
commit
.
isSelected
),
[...
this
.
commits
,
...
this
.
selectedCommits
].
filter
(
(
commit
)
=>
commit
.
isSelected
),
);
}
}
...
...
@@ -178,7 +178,7 @@ export default {
this
.
setCommits
({
commits
:
tempCommits
});
this
.
setSelectedCommits
([
...
tempSelectedCommits
,
...
tempCommits
.
filter
(
commit
=>
commit
.
isSelected
),
...
tempCommits
.
filter
(
(
commit
)
=>
commit
.
isSelected
),
]);
},
handleCreateContextCommits
()
{
...
...
@@ -186,7 +186,7 @@ export default {
return
Promise
.
all
([
this
.
createContextCommits
({
commits
:
this
.
uniqueCommits
}),
this
.
removeContextCommits
(),
]).
then
(
values
=>
{
]).
then
(
(
values
)
=>
{
if
(
values
[
0
]
||
values
[
1
])
{
window
.
location
.
reload
();
}
...
...
app/assets/javascripts/add_context_commits_modal/store/actions.js
View file @
81e82875
...
...
@@ -27,10 +27,10 @@ export const searchCommits = ({ dispatch, commit, state }, searchText) => {
return
axios
.
get
(
state
.
contextCommitsPath
,
params
)
.
then
(({
data
})
=>
{
let
commits
=
data
.
map
(
o
=>
({
...
o
,
isSelected
:
false
}));
commits
=
commits
.
map
(
c
=>
{
let
commits
=
data
.
map
(
(
o
)
=>
({
...
o
,
isSelected
:
false
}));
commits
=
commits
.
map
(
(
c
)
=>
{
const
isPresent
=
state
.
selectedCommits
.
find
(
selectedCommit
=>
selectedCommit
.
short_id
===
c
.
short_id
&&
selectedCommit
.
isSelected
,
(
selectedCommit
)
=>
selectedCommit
.
short_id
===
c
.
short_id
&&
selectedCommit
.
isSelected
,
);
if
(
isPresent
)
{
return
{
...
c
,
isSelected
:
true
};
...
...
@@ -50,7 +50,7 @@ export const searchCommits = ({ dispatch, commit, state }, searchText) => {
export
const
setCommits
=
({
commit
},
{
commits
:
data
,
silentAddition
=
false
})
=>
{
let
commits
=
_
.
uniqBy
(
data
,
'
short_id
'
);
commits
=
_
.
orderBy
(
data
,
c
=>
new
Date
(
c
.
committed_date
),
[
'
desc
'
]);
commits
=
_
.
orderBy
(
data
,
(
c
)
=>
new
Date
(
c
.
committed_date
),
[
'
desc
'
]);
if
(
silentAddition
)
{
commit
(
types
.
SET_COMMITS_SILENT
,
commits
);
}
else
{
...
...
@@ -60,7 +60,7 @@ export const setCommits = ({ commit }, { commits: data, silentAddition = false }
export
const
createContextCommits
=
({
state
},
{
commits
,
forceReload
=
false
})
=>
Api
.
createContextCommits
(
state
.
projectId
,
state
.
mergeRequestIid
,
{
commits
:
commits
.
map
(
commit
=>
commit
.
short_id
),
commits
:
commits
.
map
(
(
commit
)
=>
commit
.
short_id
),
})
.
then
(()
=>
{
if
(
forceReload
)
{
...
...
@@ -81,7 +81,7 @@ export const fetchContextCommits = ({ dispatch, commit, state }) => {
commit
(
types
.
FETCH_CONTEXT_COMMITS
);
return
Api
.
allContextCommits
(
state
.
projectId
,
state
.
mergeRequestIid
)
.
then
(({
data
})
=>
{
const
contextCommits
=
data
.
map
(
o
=>
({
...
o
,
isSelected
:
true
}));
const
contextCommits
=
data
.
map
(
(
o
)
=>
({
...
o
,
isSelected
:
true
}));
dispatch
(
'
setContextCommits
'
,
contextCommits
);
dispatch
(
'
setCommits
'
,
{
commits
:
[...
state
.
commits
,
...
contextCommits
],
...
...
@@ -121,7 +121,7 @@ export const setSelectedCommits = ({ commit }, selected) => {
let
selectedCommits
=
_
.
uniqBy
(
selected
,
'
short_id
'
);
selectedCommits
=
_
.
orderBy
(
selectedCommits
,
selectedCommit
=>
new
Date
(
selectedCommit
.
committed_date
),
(
selectedCommit
)
=>
new
Date
(
selectedCommit
.
committed_date
),
[
'
desc
'
],
);
commit
(
types
.
SET_SELECTED_COMMITS
,
selectedCommits
);
...
...
jest.config.base.js
View file @
81e82875
const
IS_EE
=
require
(
'
./config/helpers/is_ee_env
'
);
const
isESLint
=
require
(
'
./config/helpers/is_eslint
'
);
module
.
exports
=
path
=>
{
module
.
exports
=
(
path
)
=>
{
const
reporters
=
[
'
default
'
];
// To have consistent date time parsing both in local and CI environments we set
...
...
@@ -27,7 +27,7 @@ module.exports = path => {
// workaround for eslint-import-resolver-jest only resolving in test files
// see https://github.com/JoinColony/eslint-import-resolver-jest#note
if
(
isESLint
(
module
))
{
testMatch
=
testMatch
.
map
(
path
=>
path
.
replace
(
'
_spec.js
'
,
''
));
testMatch
=
testMatch
.
map
(
(
path
)
=>
path
.
replace
(
'
_spec.js
'
,
''
));
}
const
TEST_FIXTURES_PATTERN
=
'
test_fixtures(/.*)$
'
;
...
...
jest.config.js
View file @
81e82875
...
...
@@ -4,7 +4,7 @@ module.exports = {
...
baseConfig
(
'
spec/frontend
'
),
};
const
karmaTestFile
=
process
.
argv
.
find
(
arg
=>
arg
.
includes
(
'
spec/javascripts/
'
));
const
karmaTestFile
=
process
.
argv
.
find
(
(
arg
)
=>
arg
.
includes
(
'
spec/javascripts/
'
));
if
(
karmaTestFile
)
{
console
.
error
(
`
Files in spec/javascripts/ and ee/spec/javascripts need to be run with Karma.
...
...
scripts/frontend/block_dependencies.js
View file @
81e82875
...
...
@@ -5,13 +5,13 @@ const dependencies = packageJson.dependencies;
const
devDependencies
=
packageJson
.
devDependencies
;
const
blockedDependenciesNames
=
Object
.
keys
(
blockedDependencies
);
const
blockedDependenciesFound
=
blockedDependenciesNames
.
filter
(
blockedDependency
=>
dependencies
[
blockedDependency
]
||
devDependencies
[
blockedDependency
],
(
blockedDependency
)
=>
dependencies
[
blockedDependency
]
||
devDependencies
[
blockedDependency
],
);
if
(
blockedDependenciesFound
.
length
)
{
console
.
log
(
'
The following package.json dependencies are not allowed:
'
);
blockedDependenciesFound
.
forEach
(
blockedDependency
=>
{
blockedDependenciesFound
.
forEach
(
(
blockedDependency
)
=>
{
const
infoLink
=
blockedDependencies
[
blockedDependency
];
console
.
log
(
`-
${
blockedDependency
}
: See
${
infoLink
}
for more information.`
);
...
...
scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js
View file @
81e82875
...
...
@@ -27,7 +27,7 @@ const file = fs.readFileSync(paths[0], 'utf-8');
const
parsed
=
pjs
.
parse
(
file
);
if
(
parsed
.
nodes
.
every
(
node
=>
[
'
comment
'
,
'
atrule
'
].
includes
(
node
.
type
)))
{
if
(
parsed
.
nodes
.
every
(
(
node
)
=>
[
'
comment
'
,
'
atrule
'
].
includes
(
node
.
type
)))
{
console
.
log
(
'
The file does not introduce any side effects, we are all good.
'
);
process
.
exit
(
0
);
}
...
...
scripts/frontend/extract_gettext_all.js
View file @
81e82875
...
...
@@ -45,7 +45,7 @@ function printJson() {
text
+=
`\u0000
${
message
.
textPlural
}
`
;
}
message
.
references
.
forEach
(
reference
=>
{
message
.
references
.
forEach
(
(
reference
)
=>
{
const
filename
=
reference
.
replace
(
/:
\d
+$/
,
''
);
if
(
!
Array
.
isArray
(
result
[
filename
]))
{
...
...
scripts/frontend/file_test_coverage.js
View file @
81e82875
...
...
@@ -17,11 +17,11 @@ const sourceDirectories = ['app/assets/javascripts'];
const
testDirectories
=
[
'
spec/javascripts
'
,
'
spec/frontend
'
];
if
(
fs
.
existsSync
(
'
ee
'
))
{
sourceDirectories
.
forEach
(
dir
=>
{
sourceDirectories
.
forEach
(
(
dir
)
=>
{
sourceDirectories
.
push
(
`ee/
${
dir
}
`
);
});
testDirectories
.
forEach
(
dir
=>
{
testDirectories
.
forEach
(
(
dir
)
=>
{
testDirectories
.
push
(
`ee/
${
dir
}
`
);
});
}
...
...
@@ -29,10 +29,10 @@ if (fs.existsSync('ee')) {
let
numSourceFiles
=
0
;
let
numTestFiles
=
0
;
const
isVerbose
=
process
.
argv
.
some
(
arg
=>
arg
===
'
-v
'
);
const
isVerbose
=
process
.
argv
.
some
(
(
arg
)
=>
arg
===
'
-v
'
);
const
countSourceFiles
=
path
=>
forEachFileIn
(
path
,
fileName
=>
{
const
countSourceFiles
=
(
path
)
=>
forEachFileIn
(
path
,
(
fileName
)
=>
{
if
(
fileName
.
endsWith
(
'
.vue
'
)
||
fileName
.
endsWith
(
'
.js
'
))
{
if
(
isVerbose
)
{
console
.
log
(
`source file:
${
fileName
}
`
);
...
...
@@ -42,8 +42,8 @@ const countSourceFiles = path =>
}
});
const
countTestFiles
=
path
=>
forEachFileIn
(
path
,
fileName
=>
{
const
countTestFiles
=
(
path
)
=>
forEachFileIn
(
path
,
(
fileName
)
=>
{
if
(
fileName
.
endsWith
(
'
_spec.js
'
))
{
if
(
isVerbose
)
{
console
.
log
(
`test file:
${
fileName
}
`
);
...
...
@@ -63,7 +63,7 @@ function forEachFileIn(dirPath, callback) {
return
;
}
files
.
forEach
(
fileName
=>
{
files
.
forEach
(
(
fileName
)
=>
{
const
absolutePath
=
path
.
join
(
dirPath
,
fileName
);
const
stats
=
fs
.
statSync
(
absolutePath
);
if
(
stats
.
isFile
())
{
...
...
scripts/frontend/frontend_script_utils.js
View file @
81e82875
...
...
@@ -9,10 +9,10 @@ const exec = (command, args) => {
return
execFileSync
(
command
,
args
,
options
);
};
const
execGitCmd
=
args
=>
exec
(
'
git
'
,
args
).
trim
().
toString
().
split
(
'
\n
'
).
filter
(
Boolean
);
const
execGitCmd
=
(
args
)
=>
exec
(
'
git
'
,
args
).
trim
().
toString
().
split
(
'
\n
'
).
filter
(
Boolean
);
module
.
exports
=
{
getStagedFiles
:
fileExtensionFilter
=>
{
getStagedFiles
:
(
fileExtensionFilter
)
=>
{
const
gitOptions
=
[
'
diff
'
,
'
--name-only
'
,
'
--cached
'
,
'
--diff-filter=ACMRTUB
'
];
if
(
fileExtensionFilter
)
gitOptions
.
push
(...
fileExtensionFilter
);
return
execGitCmd
(
gitOptions
);
...
...
scripts/frontend/merge_coverage_frontend.js
View file @
81e82875
...
...
@@ -11,7 +11,7 @@ const reportFiles = sync(`${coverageDir}/*/coverage-final.json`);
// Normalize coverage report generated by jest that has additional "data" key
// https://github.com/facebook/jest/issues/2418#issuecomment-423806659
const
normalizeReport
=
report
=>
{
const
normalizeReport
=
(
report
)
=>
{
const
normalizedReport
=
Object
.
assign
({},
report
);
Object
.
entries
(
normalizedReport
).
forEach
(([
k
,
v
])
=>
{
if
(
v
.
data
)
normalizedReport
[
k
]
=
v
.
data
;
...
...
@@ -20,12 +20,12 @@ const normalizeReport = report => {
};
reportFiles
.
map
(
reportFile
=>
require
(
reportFile
))
.
map
(
(
reportFile
)
=>
require
(
reportFile
))
.
map
(
normalizeReport
)
.
forEach
(
report
=>
coverageMap
.
merge
(
report
));
.
forEach
(
(
report
)
=>
coverageMap
.
merge
(
report
));
const
context
=
createContext
({
coverageMap
:
coverageMap
,
dir
:
'
coverage-frontend
'
});
[
'
json
'
,
'
lcov
'
,
'
text-summary
'
,
'
clover
'
,
'
cobertura
'
].
forEach
(
reporter
=>
{
[
'
json
'
,
'
lcov
'
,
'
text-summary
'
,
'
clover
'
,
'
cobertura
'
].
forEach
(
(
reporter
)
=>
{
create
(
reporter
,
{}).
execute
(
context
);
});
scripts/frontend/prettier.js
View file @
81e82875
...
...
@@ -35,7 +35,7 @@ console.log(
`Loading all
${
allFiles
?
''
:
'
staged
'
}
files
${
globDir
?
`within
${
globDir
}
`
:
''
}
...`
,
);
const
globPatterns
=
matchExtensions
.
map
(
ext
=>
`
${
globDir
}
**/*.
${
ext
}
`
);
const
globPatterns
=
matchExtensions
.
map
(
(
ext
)
=>
`
${
globDir
}
**/*.
${
ext
}
`
);
const
matchedFiles
=
allFiles
?
glob
.
sync
(
`{
${
globPatterns
.
join
(
'
,
'
)}
}`
,
{
ignore
:
globIgnore
})
:
getStagedFiles
(
globPatterns
);
...
...
@@ -62,7 +62,7 @@ Please format each file listed below or run "${fixCommand}"
`
;
const
checkFileWithOptions
=
(
filePath
,
options
)
=>
readFileAsync
(
filePath
,
'
utf8
'
).
then
(
input
=>
{
readFileAsync
(
filePath
,
'
utf8
'
).
then
(
(
input
)
=>
{
if
(
shouldSave
)
{
const
output
=
prettier
.
format
(
input
,
options
);
if
(
input
===
output
)
{
...
...
@@ -92,7 +92,7 @@ const checkFileWithOptions = (filePath, options) =>
}
});
const
checkFileWithPrettierConfig
=
filePath
=>
const
checkFileWithPrettierConfig
=
(
filePath
)
=>
prettier
.
getFileInfo
(
filePath
,
{
ignorePath
:
'
.prettierignore
'
})
.
then
(({
ignored
,
inferredParser
})
=>
{
...
...
@@ -100,7 +100,7 @@ const checkFileWithPrettierConfig = filePath =>
ignoredCount
+=
1
;
return
;
}
return
prettier
.
resolveConfig
(
filePath
).
then
(
fileOptions
=>
{
return
prettier
.
resolveConfig
(
filePath
).
then
(
(
fileOptions
)
=>
{
const
options
=
{
...
fileOptions
,
parser
:
inferredParser
};
return
checkFileWithOptions
(
filePath
,
options
);
});
...
...
@@ -115,7 +115,7 @@ Promise.all(matchedFiles.map(checkFileWithPrettierConfig))
if
(
didWarn
)
process
.
exit
(
1
);
})
.
catch
(
e
=>
{
.
catch
(
(
e
)
=>
{
console
.
log
(
`\nAn error occurred while processing files with prettier:
${
e
.
message
}
\n`
);
process
.
exit
(
1
);
});
scripts/frontend/stylelint/stylelint-utility-map.js
View file @
81e82875
...
...
@@ -32,7 +32,7 @@ sass.render(
// This suppresses a postcss warning
from
:
undefined
,
})
.
then
(
result
=>
{
.
then
(
(
result
)
=>
{
const
selectorGroups
=
{};
utils
.
createPropertiesHashmap
(
result
.
root
,
result
,
null
,
null
,
selectorGroups
,
true
);
...
...
scripts/frontend/stylelint/stylelint-utils.js
View file @
81e82875
...
...
@@ -9,7 +9,7 @@ module.exports.createPropertiesHashmap = (
selectorGroups
,
addSelectors
,
)
=>
{
ruleRoot
.
walkRules
(
rule
=>
{
ruleRoot
.
walkRules
(
(
rule
)
=>
{
const
selector
=
rule
.
selector
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
'
'
);
if
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment