Skip to content

Commit

Permalink
Merge pull request #361 from adopted-ember-addons/update-eslint
Browse files Browse the repository at this point in the history
Update eslint
  • Loading branch information
SergeAstapov authored Nov 8, 2024
2 parents 36824a4 + 14e16b6 commit 3e31878
Show file tree
Hide file tree
Showing 9 changed files with 3,439 additions and 988 deletions.
22 changes: 0 additions & 22 deletions .eslintignore

This file was deleted.

59 changes: 0 additions & 59 deletions .eslintrc.js

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x
cache: npm
- name: Install Dependencies
run: npm ci
Expand All @@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x
cache: npm
- name: Install Dependencies
run: npm install --no-shrinkwrap
Expand All @@ -49,7 +49,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x
cache: npm
- name: Install Dependencies
run: npm install --no-shrinkwrap
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x
cache: npm
- name: Install Dependencies
run: npm ci
Expand Down
3 changes: 1 addition & 2 deletions addon/utils/to-date.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ export default function toDate(argument) {
(typeof argument === 'string' || argStr === '[object String]') &&
typeof console !== 'undefined'
) {
// eslint-disable-next-line no-console
console.warn('Please use `Date.parse` to parse strings.');
// eslint-disable-next-line no-console

console.warn(new Error().stack);
}
return new Date(NaN);
Expand Down
1 change: 0 additions & 1 deletion blueprints/validator/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env node */
module.exports = {
description: 'Generates a changeset validator',
};
132 changes: 132 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/**
* Debugging:
* https://eslint.org/docs/latest/use/configure/debug
* ----------------------------------------------------
*
* Print a file's calculated configuration
*
* npx eslint --print-config path/to/file.js
*
* Inspecting the config
*
* npx eslint --inspect-config
*
*/
import globals from 'globals';
import js from '@eslint/js';

import ember from 'eslint-plugin-ember/recommended';
import prettier from 'eslint-plugin-prettier/recommended';
import qunit from 'eslint-plugin-qunit';
import n from 'eslint-plugin-n';

import babelParser from '@babel/eslint-parser';

const esmParserOptions = {
ecmaFeatures: { modules: true },
ecmaVersion: 'latest',
requireConfigFile: false,
babelOptions: {
plugins: [
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
],
},
};

export default [
js.configs.recommended,
prettier,
ember.configs.base,
ember.configs.gjs,
/**
* Ignores must be in their own object
* https://eslint.org/docs/latest/use/configure/ignore
*/
{
ignores: [
'blueprints/validator/files',
'dist/',
'node_modules/',
'coverage/',
'!**/.*',
],
},
/**
* https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options
*/
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
{
files: ['**/*.js'],
languageOptions: {
parser: babelParser,
},
},
{
files: ['**/*.{js,gjs}'],
languageOptions: {
parserOptions: esmParserOptions,
globals: {
...globals.browser,
},
},
},
{
files: ['tests/**/*-test.{js,gjs}'],
plugins: {
qunit,
},
},
/**
* CJS node files
*/
{
files: [
'**/*.cjs',
'blueprints/**/*.js',
'config/**/*.js',
'tests/dummy/config/**/*.js',
'node-test/**/*.js',
'index.js',
'testem.js',
'testem*.js',
'.prettierrc.js',
'.stylelintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
],
plugins: {
n,
},

languageOptions: {
sourceType: 'script',
ecmaVersion: 'latest',
globals: {
...globals.mocha,
...globals.node,
},
},
},
/**
* ESM node files
*/
{
files: ['**/*.mjs'],
plugins: {
n,
},

languageOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
parserOptions: esmParserOptions,
globals: {
...globals.node,
},
},
},
];
16 changes: 0 additions & 16 deletions node-test/.eslintrc.js

This file was deleted.

Loading

0 comments on commit 3e31878

Please sign in to comment.