Skip to content

Commit

Permalink
🔋 chore: eslint commonjs globals (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdsuwwz authored Apr 16, 2024
1 parent efb5d2e commit 2ea2815
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 36 deletions.
70 changes: 35 additions & 35 deletions .stylelintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
module.exports = {
"extends": [
"stylelint-config-standard",
"stylelint-config-standard-scss",
"stylelint-config-recommended-vue",
"stylelint-config-recommended-vue/scss"
'extends': [
'stylelint-config-standard',
'stylelint-config-standard-scss',
'stylelint-config-recommended-vue',
'stylelint-config-recommended-vue/scss'
],
"ignoreFiles": ["**/*.js", "**/*.ts"],
"defaultSeverity": "error",
"rules": {
"unit-disallowed-list": [
"rem",
"pt"
'ignoreFiles': ['**/*.js', '**/*.ts'],
'defaultSeverity': 'error',
'rules': {
'unit-disallowed-list': [
'rem',
'pt'
],
"no-empty-source": null,
"block-no-empty": null,
'no-empty-source': null,
'block-no-empty': null,
'declaration-block-no-duplicate-custom-properties': null,
"font-family-no-missing-generic-family-keyword": null,
'font-family-no-missing-generic-family-keyword': null,

"selector-class-pattern": "^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$|^Mui.*$|^([a-z][a-z0-9]*)(_[a-z0-9]+)*$",
'selector-class-pattern': '^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$|^Mui.*$|^([a-z][a-z0-9]*)(_[a-z0-9]+)*$',

"scss/at-mixin-pattern": "^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$|^Mui.*$|^([a-z][a-z0-9]*)(_[a-z0-9]+)*$",
"scss/double-slash-comment-whitespace-inside": "always",
"scss/dollar-variable-pattern": null,
'scss/at-mixin-pattern': '^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$|^Mui.*$|^([a-z][a-z0-9]*)(_[a-z0-9]+)*$',
'scss/double-slash-comment-whitespace-inside': 'always',
'scss/dollar-variable-pattern': null,

"selector-pseudo-class-no-unknown": [
'selector-pseudo-class-no-unknown': [
true,
{
"ignorePseudoClasses": [
"export",
"deep"
'ignorePseudoClasses': [
'export',
'deep'
]
}
],
"property-no-unknown": null,
"at-rule-empty-line-before": [
"always",
'property-no-unknown': null,
'at-rule-empty-line-before': [
'always',
{
"except": ["first-nested", "blockless-after-same-name-blockless"]
'except': ['first-nested', 'blockless-after-same-name-blockless']
}
],
"custom-property-empty-line-before": [
"always",
'custom-property-empty-line-before': [
'always',
{
"except": ["after-custom-property", "first-nested"]
'except': ['after-custom-property', 'first-nested']
}
],
"declaration-empty-line-before": [
"always",
'declaration-empty-line-before': [
'always',
{
"except": ["after-declaration", "first-nested"]
'except': ['after-declaration', 'first-nested']
}
],
"rule-empty-line-before": ["always-multi-line"],
'rule-empty-line-before': ['always-multi-line'],

// 忽视 -webkit-xxxx 等兼容写法
"property-no-vendor-prefix": [
'property-no-vendor-prefix': [
true,
{
ignoreProperties: ["box-shadow"]
ignoreProperties: ['box-shadow']
}
]
}
Expand Down
6 changes: 5 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// import antfu from '@antfu/eslint-config'
// export default antfu()

import globals from 'globals'
import { defineFlatConfig } from 'eslint-define-config';

import * as parserTypeScript from '@typescript-eslint/parser';
Expand Down Expand Up @@ -31,7 +32,10 @@ export default defineFlatConfig([
globals: {
document: 'readonly',
navigator: 'readonly',
window: 'readonly'
window: 'readonly',
...globals.node,
...globals.es2021,
...globals.browser
},
parserOptions: {
ecmaFeatures: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"eslint-plugin-html": "8.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-vue": "9.24.0",
"globals": "^15.0.0",
"jsdom": "^24.0.0",
"postcss": "^8.4.38",
"postcss-html": "^1.6.0",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 2ea2815

Please sign in to comment.