vale cleanup (#2579)

* vale cleanup

* added --config flag to vale

* added --config flag to vale

* added --config flag to vale

* added --config flag to vale

* testing vale
This commit is contained in:
Nimra Ahmed
2023-11-20 14:00:33 +05:00
committed by GitHub
parent f5e1d7825a
commit 18ee95179e
36 changed files with 2 additions and 2 deletions

86
.github/vale-styles/docs/Acronyms.yml vendored Normal file
View File

@ -0,0 +1,86 @@
extends: conditional
message: "'%s' has no definition."
level: warning
ignorecase: false
scope: paragraph
# Ensures that the existence of 'first' implies the existence of 'second'.
first: '\b([A-Z]{3,5})\b'
second: '(?:\b[A-Z][a-z]+ )+\(([A-Z]{3,5})\)'
# ... with the exception of these:
exceptions:
- API
- ASP
- CLI
- CPU
- CMS
- CRM
- CSS
- CSV
- DEBUG
- DOM
- DPI
- FAQ
- GCC
- GDB
- GET
- GPU
- GQL
- GTK
- GUI
- HTML
- HTTP
- HTTPS
- IDE
- JAR
- JSON
- JSX
- LESS
- LLDB
- NET
- NOTE
- NVDA
- ORM
- OSS
- PATH
- PDF
- PHP
- POST
- PII
- RAM
- REPL
- RSA
- SCM
- SCSS
- SDK
- SQL
- SSH
- SSL
- SVG
- TBD
- TCP
- TODO
- TSX
- URI
- URL
- USB
- UTF
- WSL
- XML
- XSS
- YAML
- ZIP
- AWS
- REST
- MDX
- NPM
- SMS
- SID
- VIP
- UPS
- RMA
- JSONB
- USD
- SASL
- SCRAM
- FIRST
- CORS

View File

@ -0,0 +1,119 @@
extends: substitution
message: "Consider using '%s' instead of '%s'."
ignorecase: true
level: suggestion
action:
name: replace
swap:
"approximate(?:ly)?": about
abundance: plenty
accelerate: speed up
accentuate: stress
accompany: go with
accomplish: carry out|do
accorded: given
accordingly: so
accrue: add
accurate: right|exact
acquiesce: agree
acquire: get|buy
additional: more|extra
address: discuss
addressees: you
adjacent to: next to
adjustment: change
admissible: allowed
advantageous: helpful
advise: tell
aggregate: total
aircraft: plane
alleviate: ease
allocate: assign|divide
alternatively: or
alternatives: choices|options
ameliorate: improve
amend: change
anticipate: expect
apparent: clear|plain
ascertain: discover|find out
assistance: help
attain: meet
attempt: try
authorize: allow
belated: late
bestow: give
cease: stop|end
collaborate: work together
commence: begin
compensate: pay
component: part
comprise: form|include
concept: idea
concerning: about
confer: give|award
consequently: so
consolidate: merge
constitutes: forms
contains: has
convene: meet
demonstrate: show|prove
depart: leave
designate: choose
desire: want|wish
determine: decide|find
detrimental: bad|harmful
disclose: share|tell
discontinue: stop
disseminate: send|give
eliminate: end
elucidate: explain
employ: use
enclosed: inside|included
encounter: meet
endeavor: try
enumerate: count
equitable: fair
equivalent: equal
exclusively: only
expedite: hurry
facilitate: ease
females: women
finalize: complete|finish
frequently: often
identical: same
incorrect: wrong
indication: sign
initiate: start|begin
itemized: listed
jeopardize: risk
liaise: work with|partner with
maintain: keep|support
methodology: method
modify: change
monitor: check|watch
multiple: many
necessitate: cause
notify: tell
numerous: many
objective: aim|goal
obligate: bind|compel
optimum: best|most
permit: let
portion: part
possess: own
previous: earlier
previously: before
prioritize: rank
procure: buy
provide: give|offer
purchase: buy
relocate: move
solicit: request
state-of-the-art: latest
subsequent: later|next
substantial: large
sufficient: enough
terminate: end
transmit: send
utilization: use
utilize: use

View File

@ -0,0 +1,49 @@
extends: substitution
message: "Use '%s' instead of '%s'."
level: suggestion
ignorecase: true
action:
name: replace
swap:
are not: aren't
cannot: can't
could not: couldn't
did not: didn't
do not: don't
does not: doesn't
has not: hasn't
have not: haven't
how is: how's
is not: isn't
'it is(?!\.)': it's
'it''s(?=\.)': it is
should not: shouldn't
'that is(?!\.)': that's
'that''s(?=\.)': that is
'they are(?!\.)': they're
'they''re(?=\.)': they are
was not: wasn't
'we are(?!\.)': we're
'we''re(?=\.)': we are
'we have(?!\.)': we've
'we''ve(?=\.)': we have
were not: weren't
'what is(?!\.)': what's
'what''s(?=\.)': what is
'when is(?!\.)': when's
'when''s(?=\.)': when is
'where is(?!\.)': where's
'where''s(?=\.)': where is
will not: won't

View File

@ -0,0 +1,15 @@
extends: existence
message: "Avoid using first person (such as '%s')"
ignorecase: true
level: error
nonword: true
tokens:
- (?:^|\s)I\s
- (?:^|\s)I,\s
- \bI'd\b
- \bI'll\b
- \bI'm\b
- \bI've\b
- \bme\b
- \bmy\b
- \bmine\b

10
.github/vale-styles/docs/Foreign.yml vendored Normal file
View File

@ -0,0 +1,10 @@
extends: substitution
message: "Use '%s' instead of '%s'."
ignorecase: true
level: error
nonword: true
action:
name: replace
swap:
'\b(?:eg|e\.g\.)[\s,]': for example
'\b(?:ie|i\.e\.)[\s,]': that is

7
.github/vale-styles/docs/Gender.yml vendored Normal file
View File

@ -0,0 +1,7 @@
extends: existence
message: "Don't use '%s'."
level: error
ignorecase: true
tokens:
- he/she
- s/he

View File

@ -0,0 +1,7 @@
extends: existence
message: "Capitalize '%s'."
nonword: true
level: warning
scope: heading
tokens:
- ':\s[a-z]'

View File

@ -0,0 +1,13 @@
extends: existence
message: "Don't use end punctuation in headings."
link: https://medusajs.notion.site/Style-Guide-Docs-fad86dd1c5f84b48b145e959f36628e0#a5043fc5f8bc4b0b84f3ba494f817e42
nonword: true
level: warning
scope: heading
action:
name: edit
params:
- remove
- '.?!'
tokens:
- '[a-z][.?!](?:\s|$)'

7
.github/vale-styles/docs/Npm2Yarn.yml vendored Normal file
View File

@ -0,0 +1,7 @@
extends: existence
message: "Consider adding npm2yarn to ```bash"
level: warning
scope: raw
ignorecase: true
raw:
- '```bash[\n]+npm'

View File

@ -0,0 +1,10 @@
extends: substitution
message: Use '%s' instead of '%s'
level: error
scope: raw
ignorecase: false
# swap maps tokens in form of bad: good
swap:
npm i: npm install
npm start: npm run start
npm build: npm run build

View File

@ -0,0 +1,7 @@
extends: existence
message: "The -g option should be added at the end of the command"
level: error
scope: raw
ignorecase: true
raw:
- '(npm (i|install) (-g|--global)|npm (-g|--global) (i|install))'

13
.github/vale-styles/docs/Numbers.yml vendored Normal file
View File

@ -0,0 +1,13 @@
extends: existence
message: "Numbers must be spelled out"
level: error
ignorecase: true
scope: paragraph
tokens:
- '.*[0-9]+\s(?!(AM|PM))+' #need to match words before to add exceptions
- '.*[0-9][.]'
exceptions:
- '[pP]ort [0-9]+'
- 'WSL2'
- '[vV]ersions? [0-9]'
- '[v.]+[0-9]+'

12
.github/vale-styles/docs/Ordinal.yml vendored Normal file
View File

@ -0,0 +1,12 @@
extends: existence
message: "Don't add -ly to an ordinal number."
level: suggestion
action:
name: edit
params:
- trim
- ly
tokens:
- firstly
- secondly
- thirdly

6
.github/vale-styles/docs/Our.yml vendored Normal file
View File

@ -0,0 +1,6 @@
extends: existence
message: "Avoid using our"
level: warning
ignorecase: true
tokens:
- ours?

View File

@ -0,0 +1,8 @@
extends: existence
message: "Use the Oxford comma in '%s'."
link: https://docs.microsoft.com/en-us/style-guide/punctuation/commas
scope: sentence
level: suggestion
nonword: true
tokens:
- '(?:[^\s,]+,){1,} \w+ (?:and|or) \w+[.?!]'

183
.github/vale-styles/docs/Passive.yml vendored Normal file
View File

@ -0,0 +1,183 @@
extends: existence
message: "'%s' looks like passive voice."
ignorecase: true
level: warning
raw:
- \b(am|are|were|being|is|been|was|be)\b\s*
tokens:
- '[\w]+ed'
- awoken
- beat
- become
- been
- begun
- bent
- beset
- bet
- bid
- bidden
- bitten
- bled
- blown
- born
- bought
- bound
- bred
- broadcast
- broken
- brought
- built
- burnt
- burst
- cast
- caught
- chosen
- clung
- come
- cost
- crept
- cut
- dealt
- dived
- done
- drawn
- dreamt
- driven
- drunk
- dug
- eaten
- fallen
- fed
- felt
- fit
- fled
- flown
- flung
- forbidden
- foregone
- forgiven
- forgotten
- forsaken
- fought
- found
- frozen
- given
- gone
- gotten
- ground
- grown
- heard
- held
- hidden
- hit
- hung
- hurt
- kept
- knelt
- knit
- known
- laid
- lain
- leapt
- learnt
- led
- left
- lent
- let
- lighted
- lost
- made
- meant
- met
- misspelt
- mistaken
- mown
- overcome
- overdone
- overtaken
- overthrown
- paid
- pled
- proven
- put
- quit
- read
- rid
- ridden
- risen
- run
- rung
- said
- sat
- sawn
- seen
- sent
- set
- sewn
- shaken
- shaven
- shed
- shod
- shone
- shorn
- shot
- shown
- shrunk
- shut
- slain
- slept
- slid
- slit
- slung
- smitten
- sold
- sought
- sown
- sped
- spent
- spilt
- spit
- split
- spoken
- spread
- sprung
- spun
- stolen
- stood
- stridden
- striven
- struck
- strung
- stuck
- stung
- stunk
- sung
- sunk
- swept
- swollen
- sworn
- swum
- swung
- taken
- taught
- thought
- thrived
- thrown
- thrust
- told
- torn
- trodden
- understood
- upheld
- upset
- wed
- wept
- withheld
- withstood
- woken
- won
- worn
- wound
- woven
- written
- wrung

View File

@ -0,0 +1,6 @@
extends: existence
message: "Use a numeral plus the units."
nonword: true
level: error
tokens:
- '\b[a-zA-z]+\spercent\b'

View File

@ -0,0 +1,6 @@
extends: occurrence
message: "Try to keep sentences short (< 30 words)."
scope: sentence
level: suggestion
max: 30
token: \b(\w+)\b

7
.github/vale-styles/docs/Spacing.yml vendored Normal file
View File

@ -0,0 +1,7 @@
extends: existence
message: "'%s' should have one space."
level: warning
nonword: true
tokens:
- '[a-z][.?!] {2,}[A-Z]'
- '[a-z][.?!][A-Z]'

8
.github/vale-styles/docs/Terms.yml vendored Normal file
View File

@ -0,0 +1,8 @@
extends: substitution
message: Consider using '%s' instead of '%s'
level: warning
scope: raw
ignorecase: false
# swap maps tokens in form of bad: good
swap:
e-commerce: ecommerce

View File

@ -0,0 +1,7 @@
extends: existence
message: "Consider using typescript instead of tsx"
level: suggestion
scope: raw
ignorecase: true
raw:
- '```tsx'

9
.github/vale-styles/docs/We.yml vendored Normal file
View File

@ -0,0 +1,9 @@
extends: existence
message: "Avoid using first-person plural like '%s'."
level: warning
ignorecase: true
tokens:
- we
- we'(?:ve|re)
- us
- let's

121
.github/vale-styles/docs/Wordiness.yml vendored Normal file
View File

@ -0,0 +1,121 @@
extends: substitution
message: "Consider using '%s' instead of '%s'."
ignorecase: true
level: suggestion
action:
name: replace
swap:
(?:give|gave) rise to: lead to
(?:previous|prior) to: before
a (?:large)? majority of: most
a (?:large)? number of: many
a myriad of: myriad
adversely impact: hurt
all across: across
all of a sudden: suddenly
all of these: these
all of: all
all-time record: record
almost all: most
almost never: seldom
along the lines of: similar to
an adequate number of: enough
an appreciable number of: many
an estimated: about
any and all: all
are in agreement: agree
as a matter of fact: in fact
as a means of: to
as a result of: because of
as of yet: yet
as per: per
at a later date: later
at all times: always
at the present time: now
at this point in time: at this point
based in large part on: based on
based on the fact that: because
basic necessity: necessity
because of the fact that: because
came to a realization: realized
came to an abrupt end: ended abruptly
carry out an evaluation of: evaluate
close down: close
closed down: closed
complete stranger: stranger
completely separate: separate
concerning the matter of: regarding
conduct a review of: review
conduct an investigation: investigate
conduct experiments: experiment
continue on: continue
despite the fact that: although
disappear from sight: disappear
drag and drop: drag
drag-and-drop: drag
doomed to fail: doomed
due to the fact that: because
during the period of: during
during the time that: while
emergency situation: emergency
except when: unless
excessive number: too many
extend an invitation: invite
fall down: fall
fell down: fell
for the duration of: during
gather together: gather
has the ability to: can
has the capacity to: can
has the opportunity to: could
hold a meeting: meet
if this is not the case: if not
in a careful manner: carefully
in a thoughtful manner: thoughtfully
in a timely manner: timely
in an effort to: to
in between: between
in lieu of: instead of
in many cases: often
in most cases: usually
in order to: to
in some cases: sometimes
in spite of the fact that: although
in spite of: despite
in the (?:very)? near future: soon
in the event that: if
in the neighborhood of: roughly
in the vicinity of: close to
it would appear that: apparently
lift up: lift
made reference to: referred to
make reference to: refer to
mix together: mix
none at all: none
not in a position to: unable
not possible: impossible
of major importance: important
perform an assessment of: assess
pertaining to: about
place an order: order
plays a key role in: is essential to
present time: now
readily apparent: apparent
some of the: some
span across: span
subsequent to: after
successfully complete: complete
sufficient number (?:of)?: enough
take action: act
take into account: consider
the question as to whether: whether
there is no doubt but that: doubtless
this day and age: this age
this is a subject that: this subject
time (?:frame|period): time
under the provisions of: under
until such time as: until
used for fuel purposes: used for fuel
whether or not: whether
with regard to: regarding
with the exception of: except for

View File

@ -0,0 +1,9 @@
extends: metric
message: "Try to keep the Flesch-Kincaid grade level (%s) below 8."
link: https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests
formula: |
(0.39 * (words / sentences)) + (11.8 * (syllables / words)) - 15.59
condition: "> 8"
level: suggestion