Skip to content

Commit

Permalink
Lint JavaScript with eslint/prettier
Browse files Browse the repository at this point in the history
This uses `@thoughtbot/eslint-config/base`, along with the `prettier`
plugin and configuration for formatting and fixing.

One rule is overidden, as using modules is nice in the tests, but this
avoids changing the existing `index.js`.
  • Loading branch information
nickcharlton committed Feb 1, 2024
1 parent 9710d53 commit 1810141
Show file tree
Hide file tree
Showing 6 changed files with 15,031 additions and 1,926 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["@thoughtbot/eslint-config/base"],
"plugins": ["prettier"],
"rules": {
"import/extensions": "off"
}
}
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ jobs:
- uses: actions/setup-node@v4
- run: npm ci
- run: npm run lint:css

lint-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
- run: npm ci
- run: npm run lint:js
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
118 changes: 59 additions & 59 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
module.exports = {
"extends": ["stylelint-config-standard-scss", "stylelint-config-recommended"],
"plugins": [
"stylelint-declaration-block-no-ignored-properties",
"stylelint-order",
extends: ['stylelint-config-standard-scss', 'stylelint-config-recommended'],
plugins: [
'stylelint-declaration-block-no-ignored-properties',
'stylelint-order',
],
"rules": {
"at-rule-no-unknown": null,
"color-hex-length": "long",
"color-named": "never",
"comment-whitespace-inside": "always",
"declaration-block-no-redundant-longhand-properties": true,
"declaration-no-important": true,
"declaration-property-unit-allowed-list": {
"line-height": []
rules: {
'at-rule-no-unknown': null,
'color-hex-length': 'long',
'color-named': 'never',
'comment-whitespace-inside': 'always',
'declaration-block-no-redundant-longhand-properties': true,
'declaration-no-important': true,
'declaration-property-unit-allowed-list': {
'line-height': [],
},
"declaration-property-value-disallowed-list": {
"/^transition/": ["/all/"]
'declaration-property-value-disallowed-list': {
'/^transition/': ['/all/'],
},
"function-url-quotes": "always",
"length-zero-no-unit": true,
"max-nesting-depth": 3,
"no-empty-source": true,
"order/properties-alphabetical-order": true,
"plugin/declaration-block-no-ignored-properties": true,
"property-no-unknown": [
'function-url-quotes': 'always',
'length-zero-no-unit': true,
'max-nesting-depth': 3,
'no-empty-source': true,
'order/properties-alphabetical-order': true,
'plugin/declaration-block-no-ignored-properties': true,
'property-no-unknown': [
true,
{
"ignoreProperties": [
"text-size"
]
}
ignoreProperties: [
'text-size',
],
},
],
"property-no-vendor-prefix": true,
"rule-empty-line-before": [
"always",
'property-no-vendor-prefix': true,
'rule-empty-line-before': [
'always',
{
"except": [
"first-nested"
except: [
'first-nested',
],
ignore: [
'after-comment',
],
"ignore": [
"after-comment"
]
}
},
],
"scss/at-else-if-parentheses-space-before": "never",
"scss/at-extend-no-missing-placeholder": true,
"scss/at-function-parentheses-space-before": "never",
"scss/load-no-partial-leading-underscore": true,
"scss/at-import-partial-extension-blacklist": ["scss"],
"scss/at-mixin-parentheses-space-before": "never",
"scss/at-rule-no-unknown": true,
"scss/dollar-variable-colon-space-after": "always",
"scss/dollar-variable-colon-space-before": "never",
"scss/map-keys-quotes": "always",
"scss/no-duplicate-dollar-variables": true,
"scss/operator-no-unspaced": true,
"scss/selector-no-redundant-nesting-selector": true,
"scss/selector-no-union-class-name": true,
"selector-max-id": 0,
"selector-no-qualifying-type": true,
"selector-no-vendor-prefix": true,
"selector-pseudo-element-colon-notation": "double",
"selector-type-case": "lower",
"shorthand-property-no-redundant-values": true,
"value-keyword-case": "lower",
"value-no-vendor-prefix": true
}
}
'scss/at-else-if-parentheses-space-before': 'never',
'scss/at-extend-no-missing-placeholder': true,
'scss/at-function-parentheses-space-before': 'never',
'scss/load-no-partial-leading-underscore': true,
'scss/at-import-partial-extension-blacklist': ['scss'],
'scss/at-mixin-parentheses-space-before': 'never',
'scss/at-rule-no-unknown': true,
'scss/dollar-variable-colon-space-after': 'always',
'scss/dollar-variable-colon-space-before': 'never',
'scss/map-keys-quotes': 'always',
'scss/no-duplicate-dollar-variables': true,
'scss/operator-no-unspaced': true,
'scss/selector-no-redundant-nesting-selector': true,
'scss/selector-no-union-class-name': true,
'selector-max-id': 0,
'selector-no-qualifying-type': true,
'selector-no-vendor-prefix': true,
'selector-pseudo-element-colon-notation': 'double',
'selector-type-case': 'lower',
'shorthand-property-no-redundant-values': true,
'value-keyword-case': 'lower',
'value-no-vendor-prefix': true,
},
};
Loading

0 comments on commit 1810141

Please sign in to comment.