Skip to content

Commit

Permalink
Chore: Update formatting style
Browse files Browse the repository at this point in the history
  • Loading branch information
stormwarning committed Dec 20, 2022
1 parent 982b722 commit 7ac673f
Show file tree
Hide file tree
Showing 7 changed files with 437 additions and 432 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ root = true
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

Expand All @@ -14,3 +14,4 @@ trim_trailing_whitespace = false

[*.{json,yml}]
indent_size = 2
indent_style = space
8 changes: 4 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: '@zazen/eslint-config',
rules: {
'unicorn/prefer-module': 'off',
},
extends: '@zazen/eslint-config',
rules: {
'unicorn/prefer-module': 'off',
},
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Bootstrap [did][]/[does][].
2. Configure your stylelint configuration file to extend this package:
```js
module.exports = {
extends: ['stylelint-config-recess-order'],
rules: {
// Add overrides and additional rules here
},
extends: ['stylelint-config-recess-order'],
rules: {
// Add overrides and additional rules here
},
}
```

Expand Down
48 changes: 24 additions & 24 deletions __tests__/_fixtures.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
export const incorrectOrder = `
div {
background-color: slategray;
box-sizing: border-box;
flex: 1 1 auto;
font-size: 1.5rem;
grid-gap: 16px;
order: 1;
pointer-events: all;
position: relative;
transition: opacity 300ms ease;
width: 320px;
}`
div {
background-color: slategray;
box-sizing: border-box;
flex: 1 1 auto;
font-size: 1.5rem;
grid-gap: 16px;
order: 1;
pointer-events: all;
position: relative;
transition: opacity 300ms ease;
width: 320px;
}`

export const correctOrder = `
div {
position: relative;
box-sizing: border-box;
flex: 1 1 auto;
grid-gap: 16px;
order: 1;
width: 320px;
font-size: 1.5rem;
pointer-events: all;
background-color: slategray;
transition: opacity 300ms ease;
}`
div {
position: relative;
box-sizing: border-box;
flex: 1 1 auto;
grid-gap: 16px;
order: 1;
width: 320px;
font-size: 1.5rem;
pointer-events: all;
background-color: slategray;
transition: opacity 300ms ease;
}`
35 changes: 18 additions & 17 deletions __tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
import test from 'ava'
import stylelint from 'stylelint'

import { correctOrder, incorrectOrder } from './_fixtures.js'
import config from '../index.js'

import { correctOrder, incorrectOrder } from './_fixtures.js'

const runStylelint = async (code) => {
let data = await stylelint.lint({
code,
config,
})
let data = await stylelint.lint({
code,
config,
})

return data.results[0]
return data.results[0]
}

test('with incorrect property order', async (t) => {
let output = await runStylelint(incorrectOrder)

t.truthy(output.errored, 'indicates linting errors')
t.is(
output.warnings[0].text.trim(),
'Expected "box-sizing" to come before "background-color" (order/properties-order)',
'indicates a properties-order error',
)
let output = await runStylelint(incorrectOrder)

t.truthy(output.errored, 'indicates linting errors')
t.is(
output.warnings[0].text.trim(),
'Expected "box-sizing" to come before "background-color" (order/properties-order)',
'indicates a properties-order error',
)
})

test('with correct property order', async (t) => {
let output = await runStylelint(correctOrder)
let output = await runStylelint(correctOrder)

t.falsy(output.errored, 'indicates no errors')
t.is(output.warnings.length, 0)
t.falsy(output.errored, 'indicates no errors')
t.is(output.warnings.length, 0)
})
Loading

0 comments on commit 7ac673f

Please sign in to comment.