Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: CI again #33

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions .eslintrc

This file was deleted.

5 changes: 5 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ jobs:
npm install eslint@7
cd ..

mkdir ~/with-eslint-8 && cd ~/with-eslint-8
npm init --yes
npm install eslint@8
cd ..

mkdir ~/with-eslint-latest && cd ~/with-eslint-latest
npm init --yes
npm install eslint@latest
Expand Down
40 changes: 40 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const globals = require("globals");
const pluginJs = require("@eslint/js");
const importPlugin = require("eslint-plugin-import-x");

module.exports = [
{
ignores: ["spec/fixtures/**/*.js"]
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
atom: 'readonly'
},
}
},
pluginJs.configs.recommended,
{
plugins: {
importPlugin,
},
rules: {
'no-unused-vars': ['warn', {
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}]
}
},
{
files: ['spec/runner.js', 'spec/*-spec.js'],
languageOptions: {
globals: {
...globals.jasmine,
pass: 'readonly'
}
}
}
];
2 changes: 1 addition & 1 deletion lib/job-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { spawn } from 'child_process';
import { randomBytes } from 'crypto';

import NodePathTester from './node-path-tester';
import console from './console';
// import console from './console';
import Config from './config';
import ndjson from 'ndjson';

Expand Down
23 changes: 13 additions & 10 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use babel';

import { CompositeDisposable } from 'atom';
// eslint-disable-next-line import/no-unresolved
import { shell } from 'electron';
import Path from 'path';

import console from './console';
// import console from './console';
import Config from './config';
import NodePathTester from './node-path-tester';
import JobManager from './job-manager';
Expand Down Expand Up @@ -34,13 +33,15 @@ function eventInvolvesFile (event, fileName) {
return event.path.endsWith(fileName) || (event.oldPath && event.oldPath.endsWith(fileName));
}

// Catch file-change events that involve any of `.eslintrc`, `.eslintrc.js`, or
// `.eslintrc.yml`.
function eventInvolvesEslintrc (event) {
// Catch file-change events that are likely to involve ESLint config files.
function eventInvolvesEslintConfig (event) {
return [event.path, event.oldPath].some((p) => {
return p && (
p.includes(`${Path.sep}.eslintrc`) || p.startsWith(`.eslintrc`)
);
if (!p) return false;
if (p.includes(`${Path.sep}.eslintrc`)) return true;
if (p.startsWith(`.eslintrc`)) return true;
if (p.includes(`${Path.sep}eslint.config.`)) return true;
if (p.startsWith(`eslint.config.`)) return true;
return false;
});
}

Expand Down Expand Up @@ -178,7 +179,7 @@ export default {
// Instances of `ESLint` cache whatever configuration details were
// present at instantiation time. If any config changes, we can't
// re-use old instances.
if (eventInvolvesFile(event, '.eslintignore') || eventInvolvesEslintrc(event)) {
if (eventInvolvesFile(event, '.eslintignore') || eventInvolvesEslintConfig(event)) {
this.wake();
this.clearESLintCache();
}
Expand Down Expand Up @@ -461,6 +462,7 @@ export default {
},

handleError (err, type, editor = null) {
console.error(`!!!!!!!!!!!!\n\nhandleError`, type, err);
if (!Config.get('enable')) {
this.sleep(`Disabled in config`);
return;
Expand Down Expand Up @@ -544,7 +546,7 @@ export default {
if (linterEslintPresent || didNotify || !Config.get('warnAboutOldEslint')) {
return null;
} else {
// eslint-disable-next-line max-len

let description = `The ESLint module in this project is of version ${err.version}; linter-eslint-node requires a version of 8.0.0 or greater. You can install the legacy \`linter-eslint\` package if you don’t want to upgrade ESLint.\n\nYou can disable this message in package settings.`;
atom.notifications.addWarning(
`linter-eslint-node: Incompatible ESLint`,
Expand Down Expand Up @@ -586,6 +588,7 @@ export default {
grammarScopes: this.scopes,
lint: async (textEditor) => {
if (!Config.get('enable')) {
console.log('this is supposedly disabled');
this.sleep(`Disabled in config`);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/node-path-tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const NodePathTester = {
let stdout = execSync(`${bin} --version`);
this._knownGoodValues.set(bin, stdout);
return stdout;
} catch (err) {
} catch (_err) {
return false;
}
},
Expand Down
Loading
Loading