diff --git a/.eslintignore b/.eslintignore deleted file mode 120000 index 3e4e48b..0000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -.gitignore \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 2b5eec6..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,38 +0,0 @@ -// We should periodically check in on the "recommended" rules we're extending -// and remove redundancies: -// https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js - -/* eslint-env node */ -module.exports = { - root: true, - extends: 'eslint:recommended', - rules: { - eqeqeq: 'error', - 'comma-dangle': ['warn', { - arrays: 'always-multiline', - objects: 'always-multiline', - imports: 'always-multiline', - exports: 'always-multiline', - functions: 'only-multiline', - }], - 'no-console': 'warn', - 'no-prototype-builtins': 'warn', - 'no-shadow': 'warn', - 'no-undef-init': 'error', - 'no-unused-vars': 'warn', - 'no-var': 'error', - 'prefer-arrow-callback': ['error', { allowNamedFunctions: true }], - 'prefer-const': 'error', - 'quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }], - 'semi': 'warn', - }, - ignorePatterns: ['*.d.ts'], - env: { - es6: true, - browser: true, - }, - parserOptions: { - ecmaVersion: 2022, - sourceType: 'module', - }, -}; diff --git a/demo/react/.eslintrc.js b/demo/react/.eslintrc.js deleted file mode 100644 index 68ab3b5..0000000 --- a/demo/react/.eslintrc.js +++ /dev/null @@ -1,41 +0,0 @@ -// We should periodically check in on the "recommended" rules we're extending -// and remove redundancies: -// https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js - -/* eslint-env node */ -module.exports = { - globals: { - React: false, - ReactDOM: false, - }, - root: true, - extends: 'eslint:recommended', - rules: { - eqeqeq: 'error', - 'comma-dangle': ['warn', { - arrays: 'only-multiline', - objects: 'only-multiline', - imports: 'only-multiline', - exports: 'only-multiline', - functions: 'only-multiline', - }], - 'no-console': 'warn', - 'no-prototype-builtins': 'warn', - 'no-shadow': 'warn', - 'no-undef-init': 'error', - 'no-unused-vars': 'warn', - 'no-var': 'error', - 'prefer-arrow-callback': ['error', { allowNamedFunctions: true }], - 'prefer-const': 'error', - 'quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }], - 'semi': 'warn', - }, - env: { - es6: true, - browser: true, - }, - parserOptions: { - ecmaVersion: 2020, - sourceType: 'module', - }, -}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..1c28738 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,57 @@ +import globals from 'globals'; +import js from '@eslint/js'; + +const common = { + rules: { + ...js.configs.recommended.rules, + 'comma-dangle': ['warn', { + arrays: 'always-multiline', + objects: 'always-multiline', + imports: 'always-multiline', + exports: 'always-multiline', + functions: 'only-multiline', + }], + 'eqeqeq': 'error', + 'no-console': 'warn', + 'no-prototype-builtins': 'warn', + 'no-shadow': 'warn', + 'no-undef-init': 'error', + 'no-unused-vars': 'warn', + 'no-var': 'error', + 'prefer-arrow-callback': ['error', { allowNamedFunctions: true }], + 'prefer-const': 'error', + 'quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }], + 'semi': 'warn', + }, + linterOptions: { + reportUnusedDisableDirectives: true, + }, +}; + +export default [ + { + files: ['**/*.js'], + languageOptions: { globals: globals.browser }, + ...common, + ignores: [ + 'test.js', + 'demo/react/*', + ], + }, + { + files: ['demo/react/**/*.js'], + languageOptions: { globals: { ...globals.browser, React: 'readonly', ReactDOM: 'readonly' } }, + ...common, + }, + { + files: ['test.js'], + languageOptions: { globals: { ...globals.browser, ...globals.node } }, + ...common, + }, + { + ignores: [ + 'node_modules', + '*.d.ts', + ], + }, +]; diff --git a/package.json b/package.json index 99f013e..29ab02d 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "version": "1.0.0-rc.57", "license": "SEE LICENSE IN LICENSE", "repository": "https://github.com/Netflix/x-element", + "type": "module", "main": "x-element.js", "module": "x-element.js", "types": "x-element.d.ts", @@ -26,7 +27,7 @@ ], "dependencies": {}, "devDependencies": { - "eslint": "^8.47.0", + "eslint": "^8.55.0", "http-server": "^14.1.1", "puppeteer": "^21.0.3", "tap-parser": "^13.0.1" diff --git a/test.js b/test.js index 199e4d4..d55bf31 100644 --- a/test.js +++ b/test.js @@ -1,5 +1,4 @@ -/* eslint-env node */ -const puppeteer = require('puppeteer'); +import puppeteer from 'puppeteer'; (async () => { try { diff --git a/yarn.lock b/yarn.lock index 0d2c6a6..ce8d87c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -40,10 +40,10 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.6.2.tgz#1816b5f6948029c5eaacb0703b850ee0cb37d8f8" integrity sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw== -"@eslint/eslintrc@^2.1.2": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.2.tgz#c6936b4b328c64496692f76944e755738be62396" - integrity sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g== +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== dependencies: ajv "^6.12.4" debug "^4.3.2" @@ -55,17 +55,17 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@^8.47.0": - version "8.47.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.47.0.tgz#5478fdf443ff8158f9de171c704ae45308696c7d" - integrity sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og== +"@eslint/js@8.55.0": + version "8.55.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.55.0.tgz#b721d52060f369aa259cf97392403cb9ce892ec6" + integrity sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA== -"@humanwhocodes/config-array@^0.11.10": - version "0.11.10" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" - integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== +"@humanwhocodes/config-array@^0.11.13": + version "0.11.13" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.13.tgz#075dc9684f40a531d9b26b0822153c1e832ee297" + integrity sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ== dependencies: - "@humanwhocodes/object-schema" "^1.2.1" + "@humanwhocodes/object-schema" "^2.0.1" debug "^4.1.1" minimatch "^3.0.5" @@ -74,10 +74,10 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -"@humanwhocodes/object-schema@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" - integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== +"@humanwhocodes/object-schema@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz#e5211452df060fa8522b55c7b3c0c4d1981cb044" + integrity sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -135,6 +135,11 @@ dependencies: "@types/node" "*" +"@ungap/structured-clone@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" + integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -485,18 +490,19 @@ eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@^8.47.0: - version "8.47.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.47.0.tgz#c95f9b935463fb4fad7005e626c7621052e90806" - integrity sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q== +eslint@^8.55.0: + version "8.55.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.55.0.tgz#078cb7b847d66f2c254ea1794fa395bf8e7e03f8" + integrity sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.6.1" - "@eslint/eslintrc" "^2.1.2" - "@eslint/js" "^8.47.0" - "@humanwhocodes/config-array" "^0.11.10" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.55.0" + "@humanwhocodes/config-array" "^0.11.13" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" + "@ungap/structured-clone" "^1.2.0" ajv "^6.12.4" chalk "^4.0.0" cross-spawn "^7.0.2"