@eagleoutice/eslint-config-flowr 2.1.7 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,7 +19,9 @@ configuration from your `tsdoc.json`:
19
19
  ## The `flowr` plugin
20
20
 
21
21
  flowR groups its functions in helper objects (`DfEdge`, `Resolve`, `NodeId`, and friends) so that there is one obvious
22
- entry point per topic. Two rules keep the code on those entry points, both on by default.
22
+ entry point per topic. Two rules keep the code on those entry points, both on by default. A third,
23
+ `flowr/file-naming`, checks file names (`dataflow-graph.ts`, `1-setup.ts`, `Vertex.ts`) and keeps `*.spec.ts` files
24
+ below `test/`.
23
25
 
24
26
  | rule | driven by | finds |
25
27
  | :-- | :-- | :-- |
package/index.js CHANGED
@@ -10,7 +10,6 @@ const eslint_plugin_2 = __importDefault(require("@stylistic/eslint-plugin"));
10
10
  const eslint_plugin_jsdoc_1 = __importDefault(require("eslint-plugin-jsdoc"));
11
11
  const eslint_plugin_tsdoc_1 = __importDefault(require("eslint-plugin-tsdoc"));
12
12
  const eslint_plugin_unused_imports_1 = __importDefault(require("eslint-plugin-unused-imports"));
13
- const eslint_plugin_check_file_1 = __importDefault(require("eslint-plugin-check-file"));
14
13
  const eslint_plugin_import_x_1 = __importDefault(require("eslint-plugin-import-x"));
15
14
  const eslint_plugin_unicorn_1 = __importDefault(require("eslint-plugin-unicorn"));
16
15
  const plugin_1 = __importDefault(require("./plugin"));
@@ -41,7 +40,6 @@ const config = [
41
40
  '@stylistic': eslint_plugin_2.default,
42
41
  'import-x': eslint_plugin_import_x_1.default,
43
42
  'unused-imports': eslint_plugin_unused_imports_1.default,
44
- 'check-file': eslint_plugin_check_file_1.default,
45
43
  tsdoc: eslint_plugin_tsdoc_1.default,
46
44
  jsdoc: eslint_plugin_jsdoc_1.default,
47
45
  flowr: plugin_1.default,
@@ -185,12 +183,7 @@ const config = [
185
183
  throw: { after: false }
186
184
  }
187
185
  }],
188
- 'check-file/filename-naming-convention': ['error', {
189
- '**/*.ts': '?(\\d+-)?([A-Z])+([a-z])*((-|.)?([A-Z])+([a-z]))'
190
- }],
191
- 'check-file/folder-match-with-fex': ['error', {
192
- '*.spec.{js,jsx,ts,tsx}': 'test/**'
193
- }],
186
+ 'flowr/file-naming': 'error',
194
187
  '@stylistic/no-trailing-spaces': 'error',
195
188
  '@stylistic/space-infix-ops': ['error', { int32Hint: false }],
196
189
  '@typescript-eslint/no-unused-vars': 'off',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/eslint-config-flowr",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "Linting rules for flowr and friends",
5
5
  "license": "ISC",
6
6
  "repository": {
@@ -37,7 +37,6 @@
37
37
  "@stylistic/eslint-plugin": "^5.7.1",
38
38
  "@typescript-eslint/eslint-plugin": "^8.54.0",
39
39
  "@typescript-eslint/parser": "^8.54.0",
40
- "eslint-plugin-check-file": "^3.3.1",
41
40
  "eslint-plugin-import-x": "^4.17.1",
42
41
  "eslint-plugin-jsdoc": "^62.5.0",
43
42
  "eslint-plugin-tsdoc": "^0.5.0",
package/plugin.d.ts CHANGED
@@ -5,6 +5,7 @@ declare const plugin: {
5
5
  rules: {
6
6
  'use-instead': import("eslint").Rule.RuleModule;
7
7
  'replacement-pattern': import("eslint").Rule.RuleModule;
8
+ 'file-naming': import("eslint").Rule.RuleModule;
8
9
  };
9
10
  };
10
11
  export = plugin;
package/plugin.js CHANGED
@@ -5,11 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  /** The flowR-specific rules, see the README for the tags they read. */
6
6
  const replacement_pattern_1 = __importDefault(require("./rules/replacement-pattern"));
7
7
  const use_instead_1 = __importDefault(require("./rules/use-instead"));
8
+ const file_naming_1 = __importDefault(require("./rules/file-naming"));
8
9
  const plugin = {
9
10
  meta: { name: '@eagleoutice/eslint-config-flowr' },
10
11
  rules: {
11
12
  'use-instead': use_instead_1.default,
12
- 'replacement-pattern': replacement_pattern_1.default
13
+ 'replacement-pattern': replacement_pattern_1.default,
14
+ 'file-naming': file_naming_1.default
13
15
  }
14
16
  };
15
17
  module.exports = plugin;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ declare const rule: Rule.RuleModule;
3
+ export = rule;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const path_1 = __importDefault(require("path"));
6
+ /** `dataflow-graph`, `Vertex`, `1-setup`, `r-bridge.test`: lower-case words, each optionally capitalized */
7
+ const fileName = /^(\d+-)?[A-Z]?[a-z]+([-.][A-Z]?[a-z]+)*$/;
8
+ const specFile = /\.spec\.[jt]sx?$/;
9
+ const rule = {
10
+ meta: {
11
+ type: 'layout',
12
+ docs: {
13
+ description: 'enforce the flowR file naming convention and keep spec files in the test folder',
14
+ url: 'https://github.com/flowr-analysis/flowr-lint#flowrfile-naming'
15
+ },
16
+ schema: [],
17
+ messages: {
18
+ name: 'The filename "{{ name }}" does not match {{ pattern }}',
19
+ spec: 'The spec file "{{ name }}" belongs below test/'
20
+ }
21
+ },
22
+ create(context) {
23
+ return {
24
+ Program(node) {
25
+ const file = path_1.default.relative(context.cwd, context.physicalFilename).split(path_1.default.sep).join('/');
26
+ const name = path_1.default.posix.basename(file);
27
+ if (name.endsWith('.ts') && !fileName.test(name.slice(0, name.lastIndexOf('.')))) {
28
+ context.report({ node, messageId: 'name', data: { name, pattern: String(fileName) } });
29
+ }
30
+ if (specFile.test(name) && !file.startsWith('test/')) {
31
+ context.report({ node, messageId: 'spec', data: { name } });
32
+ }
33
+ }
34
+ };
35
+ }
36
+ };
37
+ module.exports = rule;