diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index f8b28f2..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,221 +0,0 @@ -module.exports = { - parser: 'babel-eslint', - parserOptions: { - ecmaVersion: 2018, - sourceType: 'module' - }, - env: { - browser: true, - node: false - }, - rules: { - 'comma-dangle': [2, 'never'], - 'no-cond-assign': 2, - 'no-console': 0, - 'no-constant-condition': 2, - 'no-control-regex': 0, - 'no-debugger': 0, - 'no-dupe-args': 0, - 'no-dupe-keys': 0, - 'no-duplicate-case': 2, - 'no-empty-character-class': 0, - 'no-empty': 2, - 'no-ex-assign': 2, - 'no-extra-boolean-cast': 2, - 'no-extra-parens': [2, 'all', { - 'conditionalAssign': false, - 'returnAssign': false, - 'nestedBinaryExpressions': false - }], - 'no-extra-semi': 2, - 'no-func-assign': 2, - 'no-inner-declarations': 2, - 'no-invalid-regexp': 0, - 'no-irregular-whitespace': 2, - 'no-negated-in-lhs': 2, - 'no-obj-calls': 0, - 'no-regex-spaces': 0, - 'no-sparse-arrays': 2, - 'no-unreachable': 2, - 'use-isnan': 2, - 'valid-jsdoc': 0, - 'valid-typeof': 0, - 'no-unexpected-multiline': 0, - 'accessor-pairs': 2, - 'block-scoped-var': 2, - 'complexity': 2, - 'consistent-return': 0, - 'curly': 2, - 'default-case': 2, - 'dot-notation': 2, - 'dot-location': 0, - 'eqeqeq': [2, 'allow-null'], - 'guard-for-in': 0, - 'no-alert': 0, - 'no-caller': 0, - 'no-div-regex': 0, - 'no-else-return': 0, - 'no-empty-label': 0, - 'no-eq-null': 0, - 'no-eval': 2, - 'no-extend-native': 0, - 'no-extra-bind': 2, - 'no-fallthrough': 2, - 'no-floating-decimal': 2, - 'no-implicit-coercion': [2, { - 'number': true, - 'string': true, - 'boolean': false - }], - 'no-implied-eval': 2, - 'no-invalid-this': 0, - 'no-iterator': 2, - 'no-labels': 0, - 'no-lone-blocks': 0, - 'no-loop-func': 2, - 'no-multi-spaces': 2, - 'no-multi-str': 0, - 'no-native-reassign': 0, - 'no-new-func': 0, - 'no-new-wrappers': 2, - 'no-new': 2, - 'no-octal-escape': 0, - 'no-octal': 0, - 'no-param-reassign': 0, - 'no-process-env': 0, - 'no-proto': 0, - 'no-redeclare': 2, - 'no-return-assign': 0, - 'no-script-url': 0, - 'no-self-compare': 0, - 'no-sequences': 0, - 'no-throw-literal': 2, - 'no-unused-expressions': 0, - 'no-useless-call': 0, - 'no-void': 0, - 'no-warning-comments': [1, { - 'terms': [ - 'todo', - ' fixme', - ' TODO', - ' FIXME' - ], - 'location': 'anywhere' - }], - 'no-with': 0, - 'radix': 2, - 'vars-on-top': 2, - 'wrap-iife': [2, 'inside'], - 'yoda': 0, - 'strict': [2, 'global'], - 'init-declarations': 0, - 'no-catch-shadow': 2, - 'no-delete-var': 2, - 'no-label-var': 0, - 'no-shadow-restricted-names': 0, - 'no-shadow': 0, - 'no-undef-init': 0, - 'no-undef': 0, - 'no-undefined': 0, - 'no-unused-vars': 2, - 'no-use-before-define': 0, - 'callback-return': 0, - 'handle-callback-err': 2, - 'no-mixed-requires': 0, - 'no-new-require': 0, - 'no-path-concat': 2, - 'no-process-exit': 2, - 'no-restricted-modules': 0, - 'no-sync': 0, - 'array-bracket-spacing': 2, - 'brace-style': [2, '1tbs', { - 'allowSingleLine': true - }], - 'camelcase': 2, - 'comma-spacing': 2, - 'comma-style': [2, 'last'], - 'computed-property-spacing': 0, - 'consistent-this': [0, 'self', 'that'], - 'eol-last': 0, - 'func-names': 0, - 'func-style': 0, - 'id-length': 0, - 'indent': [2, 2, { - 'VariableDeclarator': 1, - 'SwitchCase': 1, - 'ignoredNodes': [ - 'TemplateLiteral' - ] - }], - 'key-spacing': [2, { - 'beforeColon': false, - 'afterColon': true - }], - 'lines-around-comment': 0, - 'linebreak-style': 0, - 'max-nested-callbacks': [2, { 'maximum': 8 }], - 'new-cap': 2, - 'new-parens': 2, - 'no-array-constructor': 2, - 'no-continue': 0, - 'no-inline-comments': 0, - 'no-lonely-if': 0, - 'no-mixed-spaces-and-tabs': [2, 'smart-tabs'], - 'no-multiple-empty-lines': [2, { 'max': 1 }], - 'no-nested-ternary': 0, - 'no-new-object': 2, - 'no-spaced-func': 2, - 'no-ternary': 0, - 'no-trailing-spaces': 0, - 'no-underscore-dangle': [2, { 'allowAfterThis': true }], - 'no-unneeded-ternary': 2, - 'object-curly-spacing': [2, 'always', {}], - 'one-var': 0, - 'operator-assignment': 0, - 'operator-linebreak': 0, - 'padded-blocks': [2, { 'switches': 'always' }], - 'quote-props': [2, 'consistent'], - 'quotes': [2, 'single', 'avoid-escape'], - 'id-match': 0, - 'semi-spacing': [2, { 'after': true }], - 'semi': [2, 'always'], - 'sort-vars': 0, - 'keyword-spacing': 2, - 'space-before-blocks': 2, - 'space-before-function-paren': 0, - 'space-in-parens': 2, - 'space-infix-ops': 2, - 'space-return-throw-case': 0, - 'space-unary-ops': 0, - 'spaced-comment': [2, 'always', { - 'line': { - 'markers': ['/'], - 'exceptions': ['-', '+'] - }, - 'block': { - 'markers': ['!'], - 'exceptions': ['*'] - } - }], - 'wrap-regex': 2, - 'arrow-parens': 0, - 'arrow-spacing': 0, - 'constructor-super': 0, - 'generator-star-spacing': 0, - 'no-class-assign': 0, - 'no-const-assign': 0, - 'no-this-before-super': 0, - 'no-var': 0, - 'object-shorthand': 0, - 'prefer-const': 0, - 'prefer-spread': 0, - 'prefer-reflect': 0, - 'require-yield': 0, - 'max-depth': [2, 4], - 'max-len': [2, 200, 1, { 'ignorePattern': 'true' }], - 'max-params': 0, - 'max-statements': 0, - 'no-bitwise': [2, { 'allow': ['~'] }], - 'no-plusplus': 2 - } -}; \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a2692f..5f6860e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,16 +5,16 @@ on: [pull_request] jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: - node: [18] + node: [22] steps: - - uses: actions/checkout@v1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Installing project dependencies diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 35e1c42..832973c 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -16,12 +16,12 @@ jobs: strategy: matrix: - node-version: [18] + node-version: [22] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Installing project dependencies diff --git a/.ls-lint.yml b/.ls-lint.yml index 727c43b..4acb1ae 100644 --- a/.ls-lint.yml +++ b/.ls-lint.yml @@ -13,4 +13,5 @@ ls: ignore: - .git - - node_modules \ No newline at end of file + - node_modules + - public \ No newline at end of file diff --git a/.nvmrc b/.nvmrc index a05e3d4..b087cc9 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.20.2 \ No newline at end of file +22.13.0 \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..55211f9 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,32 @@ +import js from '@eslint/js'; +import globals from 'globals'; + +export default [ + { + // https://github.com/eslint/eslint/discussions/18304#discussioncomment-9069706 + ignores: [ + '.greenwood/*', + 'node_modules/*', + 'public/*', + 'reports/*' + ] + }, + { + languageOptions: { + parserOptions: { + ecmaVersion: 2022, + sourceType: 'module' + }, + globals: { + ...globals.browser, + ...globals.node, + ...globals.mocha + } + }, + rules: { + ...js.configs.recommended.rules, + // turn this off for Prettier + 'no-irregular-whitespace': 'off' + } + } +]; \ No newline at end of file diff --git a/greenwood.config.js b/greenwood.config.js index c217204..5a4b808 100644 --- a/greenwood.config.js +++ b/greenwood.config.js @@ -2,6 +2,31 @@ import { greenwoodPluginGoogleAnalytics } from '@greenwood/plugin-google-analyti import { greenwoodPluginImportRaw } from '@greenwood/plugin-import-raw'; import { greenwoodPluginPolyfills } from '@greenwood/plugin-polyfills'; import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss'; +import { ResourceInterface } from '@greenwood/cli/src/lib/resource-interface.js'; + +class ProcessEnvReplaceResource extends ResourceInterface { + constructor(compilation) { + super(); + + this.compilation = compilation; + } + + async shouldIntercept(url) { + return url.pathname.endsWith('redux.mjs'); + } + + async intercept(url, request, response) { + const body = await response.text(); + const env = process.env.__GWD_COMMAND__ === 'develop' ? 'development' : 'production'; + const contents = body.replace(/process.env.NODE_ENV/g, `"${env}"`); + + return new Response(contents, { + headers: new Headers({ + 'Content-Type': 'text/javascript' + }) + }); + } +} export default { devServer: { @@ -16,6 +41,11 @@ export default { greenwoodPluginPolyfills(), greenwoodPluginGoogleAnalytics({ analyticsId: 'G-0F85VEMETN' - }) + }), + { + type: 'resource', + name: 'process-env-replace', + provider: (compilation) => new ProcessEnvReplaceResource(compilation) + } ] }; \ No newline at end of file diff --git a/netlify.toml b/netlify.toml index e9c2492..ab43675 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,7 +6,7 @@ skip_processing = true [build.environment] - NODE_VERSION = "18.20.2" + NODE_VERSION = "22.x" [[redirects]] from = "/api/*" diff --git a/package.json b/package.json index 37e24e3..c70d3a6 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "clean": "rimraf ./public ./reports", "build": "greenwood build", "dev": "greenwood develop", - "lint:js": "eslint \"*.js\" \"./src/**/**/*.js\"", + "lint:js": "eslint", "lint:css": "stylelint \"./src/**/*.css\"", "lint": "ls-lint && yarn lint:js && yarn lint:css", "serve": "yarn clean && yarn build && greenwood serve", @@ -31,31 +31,31 @@ "test:tdd": "yarn test --watch" }, "dependencies": { - "lit": "^2.0.0-rc.2", + "lit": "^3.0.0", "lit-redux-router": "~0.19.0", "pwa-helpers": "^0.9.1", - "redux": "^4.0.5", - "redux-thunk": "^2.3.0" + "redux": "^5.0.1", + "redux-thunk": "^3.1.0" }, "devDependencies": { - "@babel/core": "^7.14.0", + "@double-great/stylelint-a11y": "^3.0.2", + "@eslint/js": "^9.11.1", "@esm-bundle/chai": "^4.3.4", - "@greenwood/cli": "^0.30.0", - "@greenwood/plugin-google-analytics": "^0.30.0", - "@greenwood/plugin-import-raw": "^0.30.0", - "@greenwood/plugin-polyfills": "^0.30.0", - "@greenwood/plugin-postcss": "^0.30.0", + "@greenwood/cli": "^0.31.0-alpha.6", + "@greenwood/plugin-google-analytics": "^0.31.0-alpha.6", + "@greenwood/plugin-import-raw": "^0.31.0-alpha.6", + "@greenwood/plugin-polyfills": "^0.31.0-alpha.6", + "@greenwood/plugin-postcss": "^0.31.0-alpha.6", "@ls-lint/ls-lint": "^1.10.0", "@web/test-runner": "^0.13.13", "@web/test-runner-junit-reporter": "^0.4.4", "@web/test-runner-puppeteer": "^0.10.0", - "babel-eslint": "^10.1.0", - "eslint": "^6.1.0", + "eslint": "^9.11.1", + "globals": "^15.10.0", "postcss-nested": "^4.1.2", - "rimraf": "^2.6.2", + "rimraf": "^6.0.0", "sinon": "^11.1.1", - "stylelint": "^13.8.0", - "stylelint-a11y": "^1.2.3", - "stylelint-config-standard": "^20.0.0" + "stylelint": "^16.10.0", + "stylelint-config-recommended": "^14.0.1" } } diff --git a/postcss.config.cjs b/postcss.config.cjs deleted file mode 100644 index 80bcdda..0000000 --- a/postcss.config.cjs +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - plugins: [ - require('postcss-nested') - ] -}; \ No newline at end of file diff --git a/postcss.config.mjs b/postcss.config.js similarity index 100% rename from postcss.config.mjs rename to postcss.config.js diff --git a/src/components/issues-list/issues-list.js b/src/components/issues-list/issues-list.js index 14720b6..fb6d5d8 100644 --- a/src/components/issues-list/issues-list.js +++ b/src/components/issues-list/issues-list.js @@ -14,7 +14,6 @@ class IssuesListComponent extends LitElement { }; } - /* eslint-disable indent */ render() { let { issues, labelFilters } = this; @@ -73,7 +72,6 @@ class IssuesListComponent extends LitElement { `; } - /* eslint-enable indent */ } customElements.define('cc-issues-list', IssuesListComponent); \ No newline at end of file diff --git a/src/index.js b/src/index.js index e6adefd..b6a15f1 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ import { html, LitElement } from 'lit'; import { connectRouter } from 'lit-redux-router'; import { applyMiddleware, createStore, compose, combineReducers } from 'redux'; import { lazyReducerEnhancer } from 'pwa-helpers'; -import thunk from 'redux-thunk'; +import { thunk } from 'redux-thunk'; import './components/footer/footer.js'; import './components/header/header.js'; diff --git a/src/routes/home/home.js b/src/routes/home/home.js index 2be1bf4..83dcda0 100644 --- a/src/routes/home/home.js +++ b/src/routes/home/home.js @@ -29,9 +29,6 @@ class HomePageComponent extends LitElement { selectedLanguageIndex: { type: Number }, - selectedProjectIndex: { - type: Number - }, selectedRepositoryIndex: { type: Number }, @@ -193,7 +190,6 @@ class HomePageComponent extends LitElement { labelFilters.push('good first contribution'); } - /* eslint-disable indent, max-len */ return html`