diff --git a/.xo-config.json b/.xo-config.json new file mode 100644 index 0000000000..4a5380b417 --- /dev/null +++ b/.xo-config.json @@ -0,0 +1,180 @@ +{ + "envs": [ + "browser" + ], + "semicolon": false, + "space": 2, + "ignores": [ + "**/*.min.js", + "**/dist/**", + "**/vendor/**", + "site/layouts/partials/", + "site/static/sw.js" + ], + "rules": { + "arrow-body-style": "off", + "capitalized-comments": "off", + "comma-dangle": [ + "error", + "never" + ], + "import/extensions": [ + "error", + "ignorePackages", + { + "js": "always" + } + ], + "logical-assignment-operators": "off", + "max-params": [ + "warn", + 5 + ], + "multiline-ternary": [ + "error", + "always-multiline" + ], + "new-cap": [ + "error", + { + "properties": false + } + ], + "no-console": "error", + "object-curly-spacing": [ + "error", + "always" + ], + "operator-linebreak": [ + "error", + "after" + ], + "prefer-object-has-own": "off", + "prefer-template": "error", + "strict": "error", + "unicorn/explicit-length-check": "off", + "unicorn/filename-case": "off", + "unicorn/no-array-callback-reference": "off", + "unicorn/no-array-method-this-argument": "off", + "unicorn/no-negated-condition": "off", + "unicorn/no-typeof-undefined": "off", + "unicorn/no-unused-properties": "error", + "unicorn/prefer-array-flat": "off", + "unicorn/prefer-dom-node-dataset": "off", + "unicorn/prefer-module": "off", + "unicorn/prefer-query-selector": "off", + "unicorn/prefer-spread": "off", + "unicorn/prevent-abbreviations": "off" + }, + "overrides": [ + { + "files": [ + "build/**" + ], + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "no-console": "off", + "unicorn/prefer-top-level-await": "off" + } + }, + { + "files": [ + "js/**" + ], + "parserOptions": { + "sourceType": "module" + } + }, + { + "files": [ + "js/tests/*.js", + "js/tests/integration/rollup*.js" + ], + "parserOptions": { + "sourceType": "script" + } + }, + { + "files": [ + "js/tests/unit/**" + ], + "envs": [ + "jasmine" + ], + "rules": { + "no-console": "off", + "unicorn/consistent-function-scoping": "off", + "unicorn/no-useless-undefined": "off", + "unicorn/prefer-add-event-listener": "off" + } + }, + { + "files": [ + "js/tests/visual/**" + ], + "plugins": [ + "html" + ], + "settings": { + "html/html-extensions": [ + ".html" + ] + }, + "rules": { + "no-console": "off", + "no-new": "off", + "unicorn/no-array-for-each": "off" + } + }, + { + "files": [ + "scss/tests/**" + ], + "parserOptions": { + "sourceType": "script" + } + }, + { + "files": [ + "site/**" + ], + "parserOptions": { + "sourceType": "script", + "ecmaVersion": 2019 + }, + "rules": { + "no-new": "off", + "strict": [ + "error", + "function" + ], + "unicorn/no-array-for-each": "off", + "unicorn/numeric-separators-style": "off" + } + }, + { + "files": [ + "**/*.md" + ], + "plugins": [ + "markdown" + ], + "processor": "markdown/markdown" + }, + { + "files": [ + "**/*.md/*.js", + "**/*.md/*.mjs" + ], + "extends": "plugin:markdown/recommended-legacy", + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "unicorn/prefer-node-protocol": "off" + } + } + ] +} diff --git a/package.json b/package.json index 2700597936..5bba925f20 100644 --- a/package.json +++ b/package.json @@ -177,185 +177,5 @@ "peerDependencies": { "@popperjs/core": "^2.11.8" } - }, - "xo": { - "envs": [ - "browser" - ], - "semicolon": false, - "space": 2, - "ignores": [ - "**/*.min.js", - "**/dist/**", - "**/vendor/**", - "site/layouts/partials/", - "site/static/sw.js" - ], - "rules": { - "arrow-body-style": "off", - "capitalized-comments": "off", - "comma-dangle": [ - "error", - "never" - ], - "import/extensions": [ - "error", - "ignorePackages", - { - "js": "always" - } - ], - "logical-assignment-operators": "off", - "max-params": [ - "warn", - 5 - ], - "multiline-ternary": [ - "error", - "always-multiline" - ], - "new-cap": [ - "error", - { - "properties": false - } - ], - "no-console": "error", - "object-curly-spacing": [ - "error", - "always" - ], - "operator-linebreak": [ - "error", - "after" - ], - "prefer-object-has-own": "off", - "prefer-template": "error", - "strict": "error", - "unicorn/explicit-length-check": "off", - "unicorn/filename-case": "off", - "unicorn/no-array-callback-reference": "off", - "unicorn/no-array-method-this-argument": "off", - "unicorn/no-negated-condition": "off", - "unicorn/no-typeof-undefined": "off", - "unicorn/no-unused-properties": "error", - "unicorn/prefer-array-flat": "off", - "unicorn/prefer-dom-node-dataset": "off", - "unicorn/prefer-module": "off", - "unicorn/prefer-query-selector": "off", - "unicorn/prefer-spread": "off", - "unicorn/prevent-abbreviations": "off" - }, - "overrides": [ - { - "files": [ - "build/**" - ], - "parserOptions": { - "sourceType": "module" - }, - "rules": { - "no-console": "off", - "unicorn/prefer-top-level-await": "off" - } - }, - { - "files": [ - "js/**" - ], - "parserOptions": { - "sourceType": "module" - } - }, - { - "files": [ - "js/tests/*.js", - "js/tests/integration/rollup*.js" - ], - "parserOptions": { - "sourceType": "script" - } - }, - { - "files": [ - "js/tests/unit/**" - ], - "envs": [ - "jasmine" - ], - "rules": { - "no-console": "off", - "unicorn/consistent-function-scoping": "off", - "unicorn/no-useless-undefined": "off", - "unicorn/prefer-add-event-listener": "off" - } - }, - { - "files": [ - "js/tests/visual/**" - ], - "plugins": [ - "html" - ], - "settings": { - "html/html-extensions": [ - ".html" - ] - }, - "rules": { - "no-console": "off", - "no-new": "off", - "unicorn/no-array-for-each": "off" - } - }, - { - "files": [ - "scss/tests/**" - ], - "parserOptions": { - "sourceType": "script" - } - }, - { - "files": [ - "site/**" - ], - "parserOptions": { - "sourceType": "script", - "ecmaVersion": 2019 - }, - "rules": { - "no-new": "off", - "strict": [ - "error", - "function" - ], - "unicorn/no-array-for-each": "off", - "unicorn/numeric-separators-style": "off" - } - }, - { - "files": [ - "**/*.md" - ], - "plugins": [ - "markdown" - ], - "processor": "markdown/markdown" - }, - { - "files": [ - "**/*.md/*.js", - "**/*.md/*.mjs" - ], - "extends": "plugin:markdown/recommended-legacy", - "parserOptions": { - "sourceType": "module" - }, - "rules": { - "unicorn/prefer-node-protocol": "off" - } - } - ] } }